Demo rendering location_number as text

This commit is contained in:
Tom Russell 2018-09-11 23:29:30 +01:00
parent 30e4cf2912
commit 0ec0b52f90
3 changed files with 25 additions and 4 deletions

View File

@ -7,8 +7,19 @@
</Style>
<Style name="highlight">
<Rule>
<PolygonSymbolizer fill="#4682B455" />
<Filter>[focus] = true</Filter>
<LineSymbolizer stroke="black" stroke-width="5" stroke-opacity="0.5" />
<LineSymbolizer stroke="white" stroke-width="3" />
<TextSymbolizer face-name="DejaVu Sans Condensed Bold">
[location_number]
</TextSymbolizer>
</Rule>
<Rule>
<ElseFilter />
<LineSymbolizer stroke="black" stroke-width="0.3" />
<TextSymbolizer face-name="DejaVu Sans Condensed Bold">
[location_number]
</TextSymbolizer>
</Rule>
</Style>
<Style name="size_storeys">

View File

@ -21,7 +21,7 @@ const PROJ4_STRING = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x
// register datasource adapters for mapnik
if (mapnik.register_default_input_plugins) mapnik.register_default_input_plugins();
mapnik.register_default_fonts();
const mercator = new SphericalMercator({
size: TILE_SIZE

View File

@ -25,8 +25,18 @@ router.get('/highlight/:z/:x/:y.png', function(req, res) {
if(!geometry_id) res.status(400).send({error:'Bad parameter'})
const bbox = get_bbox(req.params)
const table_def = `(
select * from geometries
where geometry_id = ${geometry_id}
SELECT
(g.geometry_id = ${geometry_id}) as focus,
cast(
b.building_doc->>'location_number'
as text
) as location_number,
g.geometry_geom
FROM
geometries as g,
buildings as b
WHERE
g.geometry_id = b.geometry_id
) as highlight`
const style_def = ['highlight']
render_tile(bbox, table_def, style_def, function(err, im) {