Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing mapnik grid usage: different grids for different layers #85

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Fixing mapnik grid usage: different grids for different layers

  • Loading branch information...
alno committed Sep 27, 2012
commit 588cc35858e28c6a3afc414d4f9f08ca511d815b
@@ -250,35 +250,24 @@ def renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom):
self.mapnik.width = width
self.mapnik.height = height
self.mapnik.zoom_to_box(Box2d(xmin, ymin, xmax, ymax))

if self.layer_id_key is not None:
grids = []

for (index, fields) in self.layers:
datasource = self.mapnik.layers[index].datasource
fields = (type(fields) is list) and map(str, fields) or datasource.fields()

grid = mapnik.render_grid(self.mapnik, index, resolution=self.scale, fields=fields)


grids = []

for (index, fields) in self.layers:
datasource = self.mapnik.layers[index].datasource
fields = (type(fields) is list) and map(str, fields) or datasource.fields()

grid = mapnik.Grid(width, height)
mapnik.render_layer(self.mapnik, grid, layer=index, fields=fields)
grid = grid.encode('utf', resolution=self.scale, features=True)

if self.layer_id_key is not None:
for key in grid['data']:
grid['data'][key][self.layer_id_key] = self.mapnik.layers[index].name

grids.append(grid)

# global_mapnik_lock.release()
outgrid = reduce(merge_grids, grids)

else:
grid = mapnik.Grid(width, height)

for (index, fields) in self.layers:
datasource = self.mapnik.layers[index].datasource
fields = (type(fields) is list) and map(str, fields) or datasource.fields()

mapnik.render_layer(self.mapnik, grid, layer=index, fields=fields)

# global_mapnik_lock.release()
outgrid = grid.encode('utf', resolution=self.scale, features=True)

grids.append(grid)

outgrid = reduce(merge_grids, grids)
except:
self.mapnik = None
raise
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.