Last active
June 2, 2016 15:27
-
-
Save hampelm/591bfc81c50348a2d1f6a3ad04d7dd40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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