Skip to content

Commit 4f7f090

Browse files
author
mbonnefoy
committed
An attempt to solve printing import error
1 parent ca710d6 commit 4f7f090

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

mapnik/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ def bootstrap_env():
7373

7474
from ._mapnik import *
7575

76-
from . import printing
77-
printing.renderer = render
78-
7976
# The base Boost.Python class
8077
BoostPythonMetaclass = Coord.__class__
8178

mapnik/printing/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import logging
88
import math
99

10-
import mapnik
1110
from mapnik import Box2d, Coord, Geometry, Layer, Map, Projection, Style, render
1211
from mapnik.printing.conversions import m2pt, m2px
1312
from mapnik.printing.formats import pagesizes
@@ -980,6 +979,8 @@ def _is_rule_within_map_scale_limits(self, m, feature, rule):
980979

981980
def _create_legend_item_map(self, m, layer, f, legend_map_size):
982981
"""Creates the legend map, i.e., a minified version of the layer map, and returns it."""
982+
from mapnik import MemoryDatasource
983+
983984
legend_map = Map(legend_map_size[0], legend_map_size[1], srs=m.srs)
984985

985986
# the buffer is needed to ensure that text labels that overflow the edge of the
@@ -989,7 +990,7 @@ def _create_legend_item_map(self, m, layer, f, legend_map_size):
989990
lestyle = self._get_layer_style_valid_rules(m, layer_style)
990991
legend_map.append_style(layer_style, lestyle)
991992

992-
ds = mapnik.MemoryDatasource()
993+
ds = MemoryDatasource()
993994
if f is None:
994995
ds = layer.datasource
995996
layer_srs = layer.srs

0 commit comments

Comments
 (0)