Add listed buildings to planning map and legend

This commit is contained in:
Maciej Ziarkowski 2020-02-09 22:51:03 +00:00
parent f68343f03e
commit 3c157f079f
4 changed files with 57 additions and 3 deletions

View File

@ -206,6 +206,33 @@
<PolygonSymbolizer fill="#73ebaf" /> <PolygonSymbolizer fill="#73ebaf" />
</Rule> </Rule>
</Style> </Style>
<Style name="planning_combined">
<Rule>
<Filter>[planning_type] = "Grade I Listed"</Filter>
<PolygonSymbolizer fill="#c72e08"/>
</Rule>
<Rule>
<Filter>[planning_type] = "Grade II* Listed"</Filter>
<PolygonSymbolizer fill="#e69800"/>
</Rule>
<Rule>
<Filter>[planning_type] = "Grade II Listed"</Filter>
<PolygonSymbolizer fill="#9ebbc9"/>
</Rule>
<Rule>
<Filter>[planning_type] = "Locally Listed"</Filter>
<PolygonSymbolizer fill="#ffbea1"/>
</Rule>
<Rule>
<Filter>[planning_type] = "Scheduled Monument"</Filter>
<PolygonSymbolizer fill="#ffffff"/>
<LineSymbolizer />
</Rule>
<Rule>
<Filter>[planning_type] = "In Conservation Area"</Filter>
<PolygonSymbolizer fill="#aaaaaa"/>
</Rule>
</Style>
<Style name="sust_dec"> <Style name="sust_dec">
<Rule> <Rule>
<Filter>[sust_dec] = A</Filter> <Filter>[sust_dec] = A</Filter>

View File

@ -107,7 +107,12 @@ const LEGEND_CONFIG = {
planning: { planning: {
title: 'Planning', title: 'Planning',
elements: [ elements: [
{ color: '#73ebaf', text: 'within conservation area' }, { color: '#c72e08', text: 'Grade I listed'},
{ color: '#e69800', text: 'Grade II* listed'},
{ color: '#9ebbc9', text: 'Grade II listed'},
{ color: '#ffbea1', text: 'Locally listed'},
{ color: '#ffffff', border: '1px solid #000000', text: 'Scheduled monument'},
{ color: '#aaaaaa', text: 'In conservation area'}
] ]
}, },
community: { community: {
@ -206,7 +211,7 @@ class Legend extends React.Component<LegendProps, LegendState> {
elements.map((item) => ( elements.map((item) => (
<li key={item.color} > <li key={item.color} >
<span className="key" style={ { background: item.color } }>-</span> <span className="key" style={ { background: item.color, border: item.border } }>-</span>
{ item.text } { item.text }
</li> </li>

View File

@ -133,7 +133,7 @@ class ColouringMap extends Component<ColouringMapProps, ColouringMapState> {
size: 'size_height', size: 'size_height',
location: 'location', location: 'location',
like: 'likes', like: 'likes',
planning: 'conservation_area', planning: 'planning_combined',
sustainability: 'sust_dec', sustainability: 'sust_dec',
type: 'building_attachment_form', type: 'building_attachment_form',
use: 'landuse' use: 'landuse'

View File

@ -87,6 +87,28 @@ const BUILDING_LAYER_DEFINITIONS = {
g.geometry_id = b.geometry_id g.geometry_id = b.geometry_id
AND b.likes_total > 0 AND b.likes_total > 0
) as likes`, ) as likes`,
planning_combined: `(
SELECT
g.geometry_geom,
(
CASE
WHEN b.planning_list_cat = 'Listed Building' and b.planning_list_grade = 'I' THEN 'Grade I Listed'
WHEN b.planning_list_cat = 'Listed Building' and b.planning_list_grade = 'II*' THEN 'Grade II* Listed'
WHEN b.planning_list_cat = 'Listed Building' and b.planning_list_grade = 'II' THEN 'Grade II Listed'
WHEN b.planning_in_local_list THEN 'Locally Listed'
WHEN b.planning_list_cat = 'Scheduled Monument' THEN 'Scheduled Monument'
WHEN b.planning_in_conservation_area THEN 'In Conservation Area'
ELSE 'None'
END
) as planning_type
FROM geometries as g
JOIN buildings as b
ON g.geometry_id = b.geometry_id
WHERE
b.planning_in_conservation_area
OR b.planning_in_local_list
OR b.planning_list_cat is not null
) as planning_combined`,
conservation_area: `( conservation_area: `(
SELECT SELECT
g.geometry_geom g.geometry_geom