Include likes map (orange if liked)

[Closes #60]
This commit is contained in:
Tom Russell 2018-10-25 13:48:48 +01:00
parent 6cc6630196
commit 0ee48597d8
3 changed files with 29 additions and 0 deletions

View File

@ -152,4 +152,9 @@
<PolygonSymbolizer fill="#7a5732" />
</Rule>
</Style>
<Style name="likes">
<Rule>
<PolygonSymbolizer fill="#f03b20" />
</Rule>
</Style>
</Map>

View File

@ -77,6 +77,7 @@ class ColouringMap extends Component {
age: 'date_year',
size: 'size_storeys',
location: 'location',
like: 'likes',
}
const data_tileset = tileset_by_cat[cat];
const dataLayer = data_tileset?

View File

@ -162,4 +162,27 @@ router.get('/location/:z/:x/:y.png', function(req, res) {
})
});
// location information depth
router.get('/likes/: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.likes_total > 0
) as location`
const style_def = ['likes']
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;