Skip to content

Instantly share code, notes, and snippets.

@geobabbler
Created November 23, 2014 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geobabbler/f723b0ad2c681e1251c5 to your computer and use it in GitHub Desktop.
Save geobabbler/f723b0ad2c681e1251c5 to your computer and use it in GitHub Desktop.
/roll up the results
query.on('row', function (result) {
if (!result) {
return res.send('No data found');
} else {
if (geom == "features") {
coll.features.push(geojson.getFeatureResult(result, spatialcol)); //use helper function
} else if (geom == "geometry") {
var shape = JSON.parse(result.geojson);
coll.geometries.push(shape);
}
}
});
//send the results
query.on('end', function (err, result) {
res.setHeader('Content-Type', 'application/json');
res.send(coll);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment