Created
November 23, 2014 14:35
-
-
Save geobabbler/b23d69193bd9699078c0 to your computer and use it in GitHub Desktop.
Code snippet 9 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
app.get('/leonardtown/buildings/:geom', function (req, res, next) { | |
var client = new pg.Client(app.conString); | |
var geom = req.params.geom.toLowerCase(); | |
if ((geom != "features") && (geom != "geometry")) { | |
res.status(404).send("Resource '" + geom + "' not found"); | |
return; | |
} | |
var tablename = "leonardtown_bldgs"; | |
var schemaname = "public"; | |
var fullname = schemaname + "." + tablename; | |
var spatialcol = ""; | |
var proptype = req.query.type; | |
var whereclause = ";"; | |
if (typeof proptype != "undefined") { | |
if (proptype.toLowerCase() != "all") { | |
whereclause = " where structure_ = '" + proptype + "';"; | |
} | |
} | |
var coll; | |
var sql = ""; | |
//logic continues from here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment