Skip to content

Instantly share code, notes, and snippets.

@geobabbler
Created November 23, 2014 14:32
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/835feff8ebde6ed3b88b to your computer and use it in GitHub Desktop.
Save geobabbler/835feff8ebde6ed3b88b to your computer and use it in GitHub Desktop.
exports.getFeatureResult = function(result, spatialcol) {
var props = new Object;
var crsobj = {
"type" : "name",
"properties" : {
"name" : "urn:ogc:def:crs:EPSG:6.3:4326"
}
};
//builds feature properties from database columns
for (var k in result) {
if (result.hasOwnProperty(k)) {
var nm = "" + k;
if ((nm != "geojson") && nm != spatialcol) {
props[nm] = result[k];
}
}
}
return {
type : "Feature",
crs : crsobj,
geometry : JSON.parse(result.geojson),
properties : props
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment