Add date-year style

This commit is contained in:
Tom Russell 2018-08-02 18:28:56 +01:00
parent 717c07595a
commit 974a29ed6a
2 changed files with 130 additions and 0 deletions
tileserver

View File

@ -114,4 +114,32 @@ app.get('/highlight/:z/:x/:y.png', function(req, res) {
})
});
// date_year choropleth
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
cast(
b.building_doc->>'date_year'
as integer
) as date_year,
g.geometry_geom
FROM
geometries as g,
buildings as b
WHERE
g.geometry_id = b.geometry_id
AND
b.building_doc ? 'date_year'
) as outline`
const style_def = ['date_year']
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'))

View File

@ -11,4 +11,106 @@
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
</Style>
<Style name="date_year">
<Rule>
<Filter>[date_year] &gt;= 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] &gt;= 1980 and [date_year] &lt; 2000</Filter>
<PolygonSymbolizer fill="#fee9a5" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1960 and [date_year] &lt; 1980</Filter>
<PolygonSymbolizer fill="#fec580" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1940 and [date_year] &lt; 1960</Filter>
<PolygonSymbolizer fill="#ffb63c" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1920 and [date_year] &lt; 1940</Filter>
<PolygonSymbolizer fill="#ff7e3e" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1900 and [date_year] &lt; 1920</Filter>
<PolygonSymbolizer fill="#ff5353" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1880 and [date_year] &lt; 1900</Filter>
<PolygonSymbolizer fill="#df73ff" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1860 and [date_year] &lt; 1880</Filter>
<PolygonSymbolizer fill="#b81ae7" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1840 and [date_year] &lt; 1860</Filter>
<PolygonSymbolizer fill="#8400a8" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1820 and [date_year] &lt; 1840</Filter>
<PolygonSymbolizer fill="#73ffdf" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1800 and [date_year] &lt; 1820</Filter>
<PolygonSymbolizer fill="#00ffc5" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1780 and [date_year] &lt; 1800</Filter>
<PolygonSymbolizer fill="#00c5ff" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1760 and [date_year] &lt; 1780</Filter>
<PolygonSymbolizer fill="#73b2ff" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1740 and [date_year] &lt; 1760</Filter>
<PolygonSymbolizer fill="#00a9e6" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1720 and [date_year] &lt; 1740</Filter>
<PolygonSymbolizer fill="#0070ff" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1700 and [date_year] &lt; 1720</Filter>
<PolygonSymbolizer fill="#004da8" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1680 and [date_year] &lt; 1700</Filter>
<PolygonSymbolizer fill="#897044" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &gt;= 1660 and [date_year] &lt; 1680</Filter>
<PolygonSymbolizer fill="#894444" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<Filter>[date_year] &lt; 1660</Filter>
<PolygonSymbolizer fill="#4c0073" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
</Style>
</Map>