Feature/435 activate sustainability (#445)

* Add colour scale definition for sustainability DEC

* Add sustainability DEC data render definition

* Activate sustainability category
This commit is contained in:
mz8i 2019-10-02 13:32:00 +01:00 committed by GitHub
parent 0954f5aa36
commit fa089f10e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 129 additions and 63 deletions

View File

@ -172,6 +172,36 @@
<PolygonSymbolizer fill="#73ebaf" /> <PolygonSymbolizer fill="#73ebaf" />
</Rule> </Rule>
</Style> </Style>
<Style name="sust_dec">
<Rule>
<Filter>[sust_dec] = A</Filter>
<PolygonSymbolizer fill="#007f3d" />
</Rule>
<Rule>
<Filter>[sust_dec] = B</Filter>
<PolygonSymbolizer fill="#2c9f29" />
</Rule>
<Rule>
<Filter>[sust_dec] = C</Filter>
<PolygonSymbolizer fill="#9dcb3c" />
</Rule>
<Rule>
<Filter>[sust_dec] = D</Filter>
<PolygonSymbolizer fill="#fff200" />
</Rule>
<Rule>
<Filter>[sust_dec] = E</Filter>
<PolygonSymbolizer fill="#f7af1d" />
</Rule>
<Rule>
<Filter>[sust_dec] = F</Filter>
<PolygonSymbolizer fill="#ed6823" />
</Rule>
<Rule>
<Filter>[sust_dec] = G</Filter>
<PolygonSymbolizer fill="#e31d23" />
</Rule>
</Style>
<Style name="likes"> <Style name="likes">
<Rule> <Rule>
<Filter>[likes] &gt;= 10</Filter> <Filter>[likes] &gt;= 10</Filter>

View File

@ -366,6 +366,11 @@ const BUILDING_FIELD_WHITELIST = new Set([
'planning_local_list_url', 'planning_local_list_url',
'planning_in_historic_area_assessment', 'planning_in_historic_area_assessment',
'planning_historic_area_assessment_url', 'planning_historic_area_assessment_url',
'sust_breeam_rating',
'sust_dec',
// 'sust_aggregate_estimate_epc',
'sust_retrofit_date',
// 'sust_life_expectancy',
]); ]);
/** /**

View File

@ -87,9 +87,9 @@ const BuildingView = (props) => {
{...props} {...props}
key={props.building && props.building.building_id} key={props.building && props.building.building_id}
title="Sustainability" title="Sustainability"
intro="Are buildings energy efficient? Coming soon…" intro="Are buildings energy efficient?"
help="https://pages.colouring.london/sustainability" help="https://pages.colouring.london/sustainability"
inactive={true} inactive={false}
/> />
case 'streetscape': case 'streetscape':
return <StreetscapeContainer return <StreetscapeContainer

View File

@ -83,7 +83,7 @@ const Categories = (props) => (
desc="Performance" desc="Performance"
slug="sustainability" slug="sustainability"
help="https://pages.colouring.london/sustainability" help="https://pages.colouring.london/sustainability"
inactive={true} inactive={false}
mode={props.mode} mode={props.mode}
building_id={props.building_id} building_id={props.building_id}
/> />

View File

@ -2,64 +2,76 @@ import React, { Fragment } from 'react';
import withCopyEdit from '../data-container'; import withCopyEdit from '../data-container';
import DataEntry from '../data-components/data-entry'; import DataEntry from '../data-components/data-entry';
import SelectDataEntry from '../data-components/select-data-entry';
import NumericDataEntry from '../data-components/numeric-data-entry';
const EnergyCategoryOptions = ["A", "B", "C", "D", "E", "F", "G"];
const BreeamRatingOptions = [
'Outstanding',
'Excellent',
'Very good',
'Good',
'Pass',
'Unclassified'
];
/** /**
* Sustainability view/edit section * Sustainability view/edit section
*/ */
const SustainabilityView = (props) => ( const SustainabilityView = (props) => {
const dataEntryProps = {
mode: props.mode,
copy: props.copy,
onChange: props.onChange
};
return (
<Fragment> <Fragment>
<p className="data-intro">{props.intro}</p> <SelectDataEntry
<ul> title="BREEAM Rating"
<li>Energy Performance Certificate (EPC) rating</li> slug="sust_breeam_rating"
{ value={props.building.sust_breeam_rating}
// "disabled": true, tooltip="(Building Research Establishment Environmental Assessment Method) May not be present for many buildings"
// "slug": "sustainability_epc_band_current", options={BreeamRatingOptions}
// "type": "text_list", {...dataEntryProps}
// "options": ["A", "B", "C", "D", "E", "F", "G"] />
} <SelectDataEntry
<li>Display Energy Certificate (DEC)</li> title="DEC Rating"
{ slug="sust_dec"
// "disabled": true, value={props.building.sust_dec}
// "slug": "sustainability_dec_band_current", tooltip="(Display Energy Certificate) Any public building should have (and display) a DEC. Showing how the energy use for that building compares to other buildings with same use"
// "type": "text_list", options={EnergyCategoryOptions}
// "options": ["A", "B", "C", "D", "E", "F", "G"] {...dataEntryProps}
} />
<li>BREEAM Rating</li> <SelectDataEntry
{ title="EPC Rating"
// "disabled": true, slug="sust_aggregate_estimate_epc"
// "slug": "sustainability_breeam_rating", value={props.building.sust_aggregate_estimate_epc}
// "type": "number", tooltip="(Energy Performance Certifcate) Any premises sold or rented is required to have an EPC to show how energy efficient it is. Only buildings rate grade E or higher maybe rented"
// "step": 1 options={EnergyCategoryOptions}
} disabled={true}
<li>Year of last significant retrofit</li> {...dataEntryProps}
{ />
// "disabled": true, <NumericDataEntry
// "slug": "sustainability_last_retrofit_date", title="Last significant retrofit"
// "type": "number", slug="sust_retrofit_date"
// "step": 1 value={props.building.sust_retrofit_date}
} tooltip="Date of last major building refurbishment"
<li>Embodied carbon estimation (for discussion)</li> step={1}
{ min={1086}
// "slug": "sustainability_embodied_carbon", max={new Date().getFullYear()}
// "type": "text", {...dataEntryProps}
// "disabled": true />
} <NumericDataEntry
<li>Adaptability/repairability rating (for discussion)</li> title="Expected lifespan for typology"
{ slug="sust_life_expectancy"
// "slug": "sustainability_adaptability_rating", value={props.building.sust_life_expectancy}
// "type": "text", step={1}
// "disabled": true min={1}
} disabled={true}
<li>Expected lifespan (for discussion)</li> {...dataEntryProps}
{ />
// "slug": "sustainability_expected_lifespan",
// "type": "number",
// "step": 1,
// "disabled": true
}
</ul>
</Fragment> </Fragment>
) );
}
const SustainabilityContainer = withCopyEdit(SustainabilityView); const SustainabilityContainer = withCopyEdit(SustainabilityView);
export default SustainabilityContainer; export default SustainabilityContainer;

View File

@ -69,7 +69,15 @@ const LEGEND_CONFIG = {
}, },
sustainability: { sustainability: {
title: 'Sustainability', title: 'Sustainability',
elements: [] elements: [
{ color: "#007f3d", text: 'A' },
{ color: "#2c9f29", text: 'B' },
{ color: "#9dcb3c", text: 'C' },
{ color: "#fff200", text: 'D' },
{ color: "#f7af1d", text: 'E' },
{ color: "#ed6823", text: 'F' },
{ color: "#e31d23", text: 'G' },
]
}, },
streetscape: { streetscape: {
title: 'Streetscape', title: 'Streetscape',

View File

@ -120,6 +120,7 @@ class ColouringMap extends Component<ColouringMapProps, ColouringMapState> { //
location: 'location', location: 'location',
like: 'likes', like: 'likes',
planning: 'conservation_area', planning: 'conservation_area',
sustainability: 'sust_dec'
}; };
const tileset = tilesetByCat[cat]; const tileset = tilesetByCat[cat];
// pick revision id to bust browser cache // pick revision id to bust browser cache

View File

@ -31,7 +31,7 @@ const BUILDING_LAYER_DEFINITIONS = {
buildings as b buildings as b
WHERE WHERE
g.geometry_id = b.geometry_id g.geometry_id = b.geometry_id
) as outline`, ) as date_year`,
size_storeys: `( size_storeys: `(
SELECT SELECT
( (
@ -44,7 +44,7 @@ const BUILDING_LAYER_DEFINITIONS = {
buildings as b buildings as b
WHERE WHERE
g.geometry_id = b.geometry_id g.geometry_id = b.geometry_id
) as outline`, ) as size_stories`,
location: `( location: `(
SELECT SELECT
( (
@ -76,7 +76,7 @@ const BUILDING_LAYER_DEFINITIONS = {
WHERE WHERE
g.geometry_id = b.geometry_id g.geometry_id = b.geometry_id
AND b.likes_total > 0 AND b.likes_total > 0
) as location`, ) as likes`,
conservation_area: `( conservation_area: `(
SELECT SELECT
g.geometry_geom g.geometry_geom
@ -86,7 +86,17 @@ const BUILDING_LAYER_DEFINITIONS = {
WHERE WHERE
g.geometry_id = b.geometry_id g.geometry_id = b.geometry_id
AND b.planning_in_conservation_area = true AND b.planning_in_conservation_area = true
) as conservation_area` ) as conservation_area`,
sust_dec: `(
SELECT
b.sust_dec::text as sust_dec,
g.geometry_geom
FROM
geometries as g,
buildings as b
WHERE
g.geometry_id = b.geometry_id
) as sust_dec`
}; };
const GEOMETRY_FIELD = 'geometry_geom'; const GEOMETRY_FIELD = 'geometry_geom';

View File

@ -32,7 +32,7 @@ const renderOrStitchRenderer = new BranchingRenderer(
const tileCache = new TileCache( const tileCache = new TileCache(
process.env.TILECACHE_PATH, process.env.TILECACHE_PATH,
{ {
tilesets: ['date_year', 'size_storeys', 'location', 'likes', 'conservation_area'], tilesets: ['date_year', 'size_storeys', 'location', 'likes', 'conservation_area', 'sust_dec'],
minZoom: 9, minZoom: 9,
maxZoom: 18, maxZoom: 18,
scales: [1, 2] scales: [1, 2]