Sketch a storeys layer
This commit is contained in:
parent
3e5f41f29f
commit
473ab1fb0e
@ -102,7 +102,7 @@ app.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
|
||||
select * from geometries
|
||||
where geometry_id = ${geometry_id}
|
||||
) as highlight`
|
||||
const style_def = ['highlight']
|
||||
@ -119,16 +119,16 @@ app.get('/date_year/:z/:x/:y.png', function(req, res) {
|
||||
const bbox = get_bbox(req.params)
|
||||
// const table_def = 'geometries'
|
||||
const table_def = `(
|
||||
SELECT
|
||||
SELECT
|
||||
cast(
|
||||
b.building_doc->>'date_year'
|
||||
as integer
|
||||
) as date_year,
|
||||
g.geometry_geom
|
||||
FROM
|
||||
geometries as g,
|
||||
FROM
|
||||
geometries as g,
|
||||
buildings as b
|
||||
WHERE
|
||||
WHERE
|
||||
g.geometry_id = b.geometry_id
|
||||
) as outline`
|
||||
const style_def = ['date_year']
|
||||
@ -140,4 +140,30 @@ app.get('/date_year/:z/:x/:y.png', function(req, res) {
|
||||
})
|
||||
});
|
||||
|
||||
// date_year choropleth
|
||||
app.get('/size_storeys/:z/:x/:y.png', function(req, res) {
|
||||
const bbox = get_bbox(req.params)
|
||||
// const table_def = 'geometries'
|
||||
const table_def = `(
|
||||
SELECT
|
||||
cast(
|
||||
b.building_doc->>'size_storeys'
|
||||
as integer
|
||||
) as size_storeys,
|
||||
g.geometry_geom
|
||||
FROM
|
||||
geometries as g,
|
||||
buildings as b
|
||||
WHERE
|
||||
g.geometry_id = b.geometry_id
|
||||
) as outline`
|
||||
const style_def = ['size_storeys']
|
||||
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'))
|
||||
})
|
||||
});
|
||||
|
||||
app.listen(8082, () => console.log('Tile server listening on port 8082'))
|
||||
|
@ -1,121 +1,157 @@
|
||||
<Map minimum-version="2.0.0">
|
||||
<Style name="polygon">
|
||||
<Rule>
|
||||
<PolygonSymbolizer fill="#4682B477" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Style name="highlight">
|
||||
<Rule>
|
||||
<PolygonSymbolizer fill="#4682B4ff" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Style name="date_year">
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 2000</Filter>
|
||||
<PolygonSymbolizer fill="#fcfcb8" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<ElseFilter />
|
||||
<PolygonSymbolizer fill="#ffffff33" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1980 and [date_year] < 2000</Filter>
|
||||
<PolygonSymbolizer fill="#fee9a5" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1960 and [date_year] < 1980</Filter>
|
||||
<PolygonSymbolizer fill="#fec580" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1940 and [date_year] < 1960</Filter>
|
||||
<PolygonSymbolizer fill="#ffb63c" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1920 and [date_year] < 1940</Filter>
|
||||
<PolygonSymbolizer fill="#ff7e3e" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1900 and [date_year] < 1920</Filter>
|
||||
<PolygonSymbolizer fill="#ff5353" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1880 and [date_year] < 1900</Filter>
|
||||
<PolygonSymbolizer fill="#df73ff" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1860 and [date_year] < 1880</Filter>
|
||||
<PolygonSymbolizer fill="#b81ae7" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1840 and [date_year] < 1860</Filter>
|
||||
<PolygonSymbolizer fill="#8400a8" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1820 and [date_year] < 1840</Filter>
|
||||
<PolygonSymbolizer fill="#73ffdf" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1800 and [date_year] < 1820</Filter>
|
||||
<PolygonSymbolizer fill="#00ffc5" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1780 and [date_year] < 1800</Filter>
|
||||
<PolygonSymbolizer fill="#00c5ff" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1760 and [date_year] < 1780</Filter>
|
||||
<PolygonSymbolizer fill="#73b2ff" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1740 and [date_year] < 1760</Filter>
|
||||
<PolygonSymbolizer fill="#00a9e6" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1720 and [date_year] < 1740</Filter>
|
||||
<PolygonSymbolizer fill="#0070ff" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1700 and [date_year] < 1720</Filter>
|
||||
<PolygonSymbolizer fill="#004da8" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1680 and [date_year] < 1700</Filter>
|
||||
<PolygonSymbolizer fill="#897044" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1660 and [date_year] < 1680</Filter>
|
||||
<PolygonSymbolizer fill="#894444" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] < 1660</Filter>
|
||||
<PolygonSymbolizer fill="#4c0073" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<ElseFilter />
|
||||
<PolygonSymbolizer fill="#00000000" />
|
||||
<LineSymbolizer stroke="black" stroke-width="0.3" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Style name="polygon">
|
||||
<Rule>
|
||||
<PolygonSymbolizer fill="#4682B477" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Style name="highlight">
|
||||
<Rule>
|
||||
<LineSymbolizer stroke="white" stroke-width="3" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Style name="size_storeys">
|
||||
<Rule>
|
||||
<Filter>[size_storeys] >= 20</Filter>
|
||||
<PolygonSymbolizer fill="#ffc584" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[size_storeys] >= 10 and [size_storeys] < 20</Filter>
|
||||
<PolygonSymbolizer fill="#f46259" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[size_storeys] >= 5 and [size_storeys] < 10</Filter>
|
||||
<PolygonSymbolizer fill="#da456a" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[size_storeys] = 4</Filter>
|
||||
<PolygonSymbolizer fill="#a8327d" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[size_storeys] = 3</Filter>
|
||||
<PolygonSymbolizer fill="#7c2383" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[size_storeys] = 2</Filter>
|
||||
<PolygonSymbolizer fill="#5b167f" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[size_storeys] = 1</Filter>
|
||||
<PolygonSymbolizer fill="#360f69" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<ElseFilter />
|
||||
<PolygonSymbolizer fill="#00000000" />
|
||||
<LineSymbolizer stroke="black" stroke-width="0.3" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Style name="date_year">
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 2000</Filter>
|
||||
<PolygonSymbolizer fill="#fcfcb8" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1980 and [date_year] < 2000</Filter>
|
||||
<PolygonSymbolizer fill="#fee9a5" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1960 and [date_year] < 1980</Filter>
|
||||
<PolygonSymbolizer fill="#fec580" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1940 and [date_year] < 1960</Filter>
|
||||
<PolygonSymbolizer fill="#ffb63c" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1920 and [date_year] < 1940</Filter>
|
||||
<PolygonSymbolizer fill="#ff7e3e" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1900 and [date_year] < 1920</Filter>
|
||||
<PolygonSymbolizer fill="#ff5353" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1880 and [date_year] < 1900</Filter>
|
||||
<PolygonSymbolizer fill="#df73ff" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1860 and [date_year] < 1880</Filter>
|
||||
<PolygonSymbolizer fill="#b81ae7" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1840 and [date_year] < 1860</Filter>
|
||||
<PolygonSymbolizer fill="#8400a8" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1820 and [date_year] < 1840</Filter>
|
||||
<PolygonSymbolizer fill="#73ffdf" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1800 and [date_year] < 1820</Filter>
|
||||
<PolygonSymbolizer fill="#00ffc5" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1780 and [date_year] < 1800</Filter>
|
||||
<PolygonSymbolizer fill="#00c5ff" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1760 and [date_year] < 1780</Filter>
|
||||
<PolygonSymbolizer fill="#73b2ff" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1740 and [date_year] < 1760</Filter>
|
||||
<PolygonSymbolizer fill="#00a9e6" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1720 and [date_year] < 1740</Filter>
|
||||
<PolygonSymbolizer fill="#0070ff" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1700 and [date_year] < 1720</Filter>
|
||||
<PolygonSymbolizer fill="#004da8" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1680 and [date_year] < 1700</Filter>
|
||||
<PolygonSymbolizer fill="#897044" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] >= 1660 and [date_year] < 1680</Filter>
|
||||
<PolygonSymbolizer fill="#894444" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[date_year] < 1660</Filter>
|
||||
<PolygonSymbolizer fill="#4c0073" />
|
||||
<LineSymbolizer stroke="white" stroke-width="0.3" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<ElseFilter />
|
||||
<PolygonSymbolizer fill="#00000000" />
|
||||
<LineSymbolizer stroke="black" stroke-width="0.3" />
|
||||
</Rule>
|
||||
</Style>
|
||||
</Map>
|
||||
|
Loading…
Reference in New Issue
Block a user