Update base layers

- simplify age render (no outline)
- base_light/base_night tiles
- cyan highlight

[Closes #50]
This commit is contained in:
Tom Russell 2018-10-25 10:16:18 +01:00
parent bed063f238
commit 3abbf4bbe8
3 changed files with 54 additions and 43 deletions

View File

@ -1,25 +1,25 @@
<Map minimum-version="2.0.0"> <Map minimum-version="2.0.0">
<Style name="polygon"> <Style name="base_light">
<Rule> <Rule>
<PolygonSymbolizer fill="#4682B477" /> <PolygonSymbolizer fill="#cccccc" />
<LineSymbolizer stroke="white" stroke-width="0.3" /> <TextSymbolizer face-name="DejaVu Sans Condensed Bold" fill="#000000">
[location_number]
</TextSymbolizer>
</Rule>
</Style>
<Style name="base_night">
<Rule>
<PolygonSymbolizer fill="#303044" />
<TextSymbolizer face-name="DejaVu Sans Condensed Bold" fill="#ffffff">
[location_number]
</TextSymbolizer>
</Rule> </Rule>
</Style> </Style>
<Style name="highlight"> <Style name="highlight">
<Rule> <Rule>
<Filter>[focus] = true</Filter> <Filter>[focus] = true</Filter>
<LineSymbolizer stroke="black" stroke-width="5" stroke-opacity="0.5" /> <LineSymbolizer stroke="#00ffffaa" stroke-width="4.5" />
<LineSymbolizer stroke="white" stroke-width="3" /> <LineSymbolizer stroke="#00ffffff" stroke-width="2.5" />
<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> </Rule>
</Style> </Style>
<Style name="size_storeys"> <Style name="size_storeys">
@ -56,102 +56,78 @@
<Rule> <Rule>
<Filter>[date_year] &gt;= 2000</Filter> <Filter>[date_year] &gt;= 2000</Filter>
<PolygonSymbolizer fill="#f0eaba" /> <PolygonSymbolizer fill="#f0eaba" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1980 and [date_year] &lt; 2000</Filter> <Filter>[date_year] &gt;= 1980 and [date_year] &lt; 2000</Filter>
<PolygonSymbolizer fill="#fae269" /> <PolygonSymbolizer fill="#fae269" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1960 and [date_year] &lt; 1980</Filter> <Filter>[date_year] &gt;= 1960 and [date_year] &lt; 1980</Filter>
<PolygonSymbolizer fill="#fbaf27" /> <PolygonSymbolizer fill="#fbaf27" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1940 and [date_year] &lt; 1960</Filter> <Filter>[date_year] &gt;= 1940 and [date_year] &lt; 1960</Filter>
<PolygonSymbolizer fill="#e6711d" /> <PolygonSymbolizer fill="#e6711d" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1920 and [date_year] &lt; 1940</Filter> <Filter>[date_year] &gt;= 1920 and [date_year] &lt; 1940</Filter>
<PolygonSymbolizer fill="#d73d3a" /> <PolygonSymbolizer fill="#d73d3a" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1900 and [date_year] &lt; 1920</Filter> <Filter>[date_year] &gt;= 1900 and [date_year] &lt; 1920</Filter>
<PolygonSymbolizer fill="#ba221c" /> <PolygonSymbolizer fill="#ba221c" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1880 and [date_year] &lt; 1900</Filter> <Filter>[date_year] &gt;= 1880 and [date_year] &lt; 1900</Filter>
<PolygonSymbolizer fill="#bb859b" /> <PolygonSymbolizer fill="#bb859b" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1860 and [date_year] &lt; 1880</Filter> <Filter>[date_year] &gt;= 1860 and [date_year] &lt; 1880</Filter>
<PolygonSymbolizer fill="#8b3654" /> <PolygonSymbolizer fill="#8b3654" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1840 and [date_year] &lt; 1860</Filter> <Filter>[date_year] &gt;= 1840 and [date_year] &lt; 1860</Filter>
<PolygonSymbolizer fill="#8f5385" /> <PolygonSymbolizer fill="#8f5385" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1820 and [date_year] &lt; 1840</Filter> <Filter>[date_year] &gt;= 1820 and [date_year] &lt; 1840</Filter>
<PolygonSymbolizer fill="#56619b" /> <PolygonSymbolizer fill="#56619b" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1800 and [date_year] &lt; 1820</Filter> <Filter>[date_year] &gt;= 1800 and [date_year] &lt; 1820</Filter>
<PolygonSymbolizer fill="#6793b2" /> <PolygonSymbolizer fill="#6793b2" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1780 and [date_year] &lt; 1800</Filter> <Filter>[date_year] &gt;= 1780 and [date_year] &lt; 1800</Filter>
<PolygonSymbolizer fill="#83c3b3" /> <PolygonSymbolizer fill="#83c3b3" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1760 and [date_year] &lt; 1780</Filter> <Filter>[date_year] &gt;= 1760 and [date_year] &lt; 1780</Filter>
<PolygonSymbolizer fill="#adc88f" /> <PolygonSymbolizer fill="#adc88f" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1740 and [date_year] &lt; 1760</Filter> <Filter>[date_year] &gt;= 1740 and [date_year] &lt; 1760</Filter>
<PolygonSymbolizer fill="#83a663" /> <PolygonSymbolizer fill="#83a663" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1720 and [date_year] &lt; 1740</Filter> <Filter>[date_year] &gt;= 1720 and [date_year] &lt; 1740</Filter>
<PolygonSymbolizer fill="#77852d" /> <PolygonSymbolizer fill="#77852d" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1700 and [date_year] &lt; 1720</Filter> <Filter>[date_year] &gt;= 1700 and [date_year] &lt; 1720</Filter>
<PolygonSymbolizer fill="#69814e" /> <PolygonSymbolizer fill="#69814e" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1680 and [date_year] &lt; 1700</Filter> <Filter>[date_year] &gt;= 1680 and [date_year] &lt; 1700</Filter>
<PolygonSymbolizer fill="#d0c291" /> <PolygonSymbolizer fill="#d0c291" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &gt;= 1660 and [date_year] &lt; 1680</Filter> <Filter>[date_year] &gt;= 1660 and [date_year] &lt; 1680</Filter>
<PolygonSymbolizer fill="#918158" /> <PolygonSymbolizer fill="#918158" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule> </Rule>
<Rule> <Rule>
<Filter>[date_year] &lt; 1660</Filter> <Filter>[date_year] &lt; 1660</Filter>
<PolygonSymbolizer fill="#7a5732" /> <PolygonSymbolizer fill="#7a5732" />
<LineSymbolizer stroke="white" stroke-width="0.3" />
</Rule>
<Rule>
<ElseFilter />
<PolygonSymbolizer fill="#00000000" />
<LineSymbolizer stroke="black" stroke-width="0.3" />
</Rule> </Rule>
</Style> </Style>
</Map> </Map>

View File

@ -89,6 +89,10 @@ class ColouringMap extends Component {
<TileLayer key={this.props.building.building_id} url={highlight} /> <TileLayer key={this.props.building.building_id} url={highlight} />
: null; : null;
const base_layer_url = (this.state.theme === 'light')?
`/tiles/base_light/{z}/{x}/{y}.png`
: `/tiles/base_night/{z}/{x}/{y}.png`
return ( return (
<Fragment> <Fragment>
<Map <Map
@ -102,6 +106,7 @@ class ColouringMap extends Component {
onClick={this.handleClick} onClick={this.handleClick}
> >
<TileLayer url={url} attribution={attribution} /> <TileLayer url={url} attribution={attribution} />
<TileLayer url={base_layer_url} />
{ dataLayer } { dataLayer }
{ highlightLayer } { highlightLayer }
<ZoomControl position="topright" /> <ZoomControl position="topright" />

View File

@ -11,10 +11,41 @@ import { strictParseInt } from './parse';
const router = express.Router() const router = express.Router()
// basic geometry tiles // basic geometry tiles
router.get('/outline/:z/:x/:y.png', function(req, res) { router.get('/base_light/:z/:x/:y.png', function(req, res) {
const bbox = get_bbox(req.params) const bbox = get_bbox(req.params)
const table_def = 'geometries' const table_def = `(
const style_def = ['polygon'] SELECT
b.location_number as location_number,
g.geometry_geom
FROM
geometries as g,
buildings as b
WHERE
g.geometry_id = b.geometry_id
) as outline`
const style_def = ['base_light']
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'))
})
});
// dark theme
router.get('/base_night/:z/:x/:y.png', function(req, res) {
const bbox = get_bbox(req.params)
const table_def = `(
SELECT
b.location_number as location_number,
g.geometry_geom
FROM
geometries as g,
buildings as b
WHERE
g.geometry_id = b.geometry_id
) as outline`
const style_def = ['base_night']
render_tile(bbox, table_def, style_def, function(err, im) { render_tile(bbox, table_def, style_def, function(err, im) {
if (err) throw err if (err) throw err
@ -35,7 +66,6 @@ router.get('/highlight/:z/:x/:y.png', function(req, res) {
const table_def = `( const table_def = `(
SELECT SELECT
g.geometry_id = ${geometry_id} as focus, g.geometry_id = ${geometry_id} as focus,
b.location_number as location_number,
g.geometry_geom g.geometry_geom
FROM FROM
geometries as g, geometries as g,