Skip to content

Instantly share code, notes, and snippets.

@hampelm
Last active June 2, 2016 15:27
Show Gist options
  • Save hampelm/591bfc81c50348a2d1f6a3ad04d7dd40 to your computer and use it in GitHub Desktop.
Save hampelm/591bfc81c50348a2d1f6a3ad04d7dd40 to your computer and use it in GitHub Desktop.
var vt = new mapnik.VectorTile(z, x, y);
// Get data in the tile
var stream = collection.find({ ... within query ...}).stream();
stream.on('data', function(data) {
vt.addGeoJSON(JSON.stringify(data.feature), 'my-layer');
});
stream.on('end', function() {
// should probably stream the results back for more efficiency
var tile = vt.getDataSync();
res.send(tile);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment