Created
November 23, 2014 14:32
-
-
Save geobabbler/835feff8ebde6ed3b88b to your computer and use it in GitHub Desktop.
Code snippet 5 for blog post http://blog.geomusings.com/2014/02/18/a-little-deeper-with-node-and-postgis/
This file contains 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
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