Add conservation area route to tileserver

This commit is contained in:
Tom Russell 2019-01-19 16:55:30 +00:00
parent fa53a2068e
commit c46e59f19a

View File

@ -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) { router.get('/likes/:z/:x/:y.png', function(req, res) {
const bbox = get_bbox(req.params) const bbox = get_bbox(req.params)
const table_def = `( 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; export default router;