Skip to content

Commit

Permalink
Add zoom, x, y and bbox variables to opts
Browse files Browse the repository at this point in the history
Add some variables to be used later on by mapnik postgis input for token
substitution.

Note that the actual substitution depends on some changes in node-mapnik
and mapnik-vector-tile:

mapbox/mapnik-vector-tile#248
https://github.com/CartoDB/node-mapnik/blob/v3.6.2-carto/CHANGELOG.carto.md#362-carto1
CartoDB/node-mapnik#10
  • Loading branch information
Rafa de la Torre committed Jan 9, 2018
1 parent 5710e86 commit 820f40f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,14 @@ Bridge.getVector = function(source, map, z, x, y, callback) {
// enable strictly_simple
opts.strictly_simple = true;

// make zoom_level variable available to mapnik postgis datasource
opts.variables = { "zoom_level": z };
// make zoom, x, y and bbox variables available to mapnik postgis datasource
opts.variables = {
zoom_level: z, // for backwards compatibility
zoom: z,
x: x,
y: y,
bbox: JSON.stringify(map.extent)
};

map.render(vtile, opts, function(err, vtile) {
source._map.release(map);
Expand Down

0 comments on commit 820f40f

Please sign in to comment.