Skip to content

Commit

Permalink
Bumped to 1.32.2 with disambiguiated null vs. empty list behavior of …
Browse files Browse the repository at this point in the history
…Mapnik Grid fields
  • Loading branch information
Michal Migurski committed May 8, 2012
1 parent 7fd35bb commit ca7a655
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions API.html
Expand Up @@ -1248,6 +1248,8 @@ <h4><a id="mapnik-grid-provider" name="mapnik-grid-provider">Mapnik Grid</a></h4
<dt>fields</dt>
<dd>
Optional array of field names to return in the response, defaults to all.
An empty list will return no field names, while a value of <samp>null</samp>
is equivalent to all.
</dd>
<dt>layer index</dt>
<dd>
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG
@@ -1,3 +1,6 @@
2012-05-07: 1.32.2
- Disambiguated null vs. empty list behavior of Mapnik Grid fields.

2012-05-06: 1.32.1
- Fixed output of Mapnik Grid to be pure UTF-8 instead of ASCII-encoded for size.

Expand Down
8 changes: 7 additions & 1 deletion TileStache/Mapnik.py
Expand Up @@ -147,6 +147,8 @@ class GridProvider:
- fields (optional)
Array of field names to return in the response, defaults to all.
An empty list will return no field names, while a value of null is
equivalent to all.
- layer index (optional)
Which layer from the mapfile to render, defaults to 0 (first layer).
Expand Down Expand Up @@ -199,7 +201,11 @@ def renderArea(self, width, height, srs, xmin, ymin, xmax, ymax, zoom):

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

if type(fields) is list:
fields = map(str, fields)
else:
fields = datasource.fields()

grid = mapnik.render_grid(self.mapnik, index, resolution=self.scale, fields=fields)
grids.append(grid)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
1.32.1
1.32.2

0 comments on commit ca7a655

Please sign in to comment.