From c46e59f19a3c9d8084b7e11ec93fd89fa0ac8eb8 Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Sat, 19 Jan 2019 16:55:30 +0000 Subject: [PATCH] Add conservation area route to tileserver --- app/src/tileserver.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/app/src/tileserver.js b/app/src/tileserver.js index 291b51f4..dffbb7ad 100644 --- a/app/src/tileserver.js +++ b/app/src/tileserver.js @@ -163,7 +163,7 @@ router.get('/location/:z/:x/:y.png', function(req, res) { }); -// location information depth +// likes router.get('/likes/:z/:x/:y.png', function(req, res) { const bbox = get_bbox(req.params) const table_def = `( @@ -186,4 +186,27 @@ router.get('/likes/:z/:x/:y.png', function(req, res) { }) }); + +// conservation status +router.get('/conservation_area/:z/:x/:y.png', function(req, res) { + const bbox = get_bbox(req.params) + const table_def = `( + SELECT + g.geometry_geom + FROM + geometries as g, + buildings as b + WHERE + g.geometry_id = b.geometry_id + AND b.planning_in_conservation_area = true + ) as conservation_area` + const style_def = ['planning_in_conservation_area'] + render_tile(bbox, table_def, style_def, function(err, im) { + if (err) throw err + + res.writeHead(200, {'Content-Type': 'image/png'}) + res.end(im.encodeSync('png')) + }) +}); + export default router;