Activate type category and colour map ()

This commit is contained in:
mz8i 2019-10-02 14:34:44 +01:00 committed by GitHub
parent fa089f10e1
commit 606a36ce6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 85 additions and 20 deletions

View File

@ -202,6 +202,24 @@
<PolygonSymbolizer fill="#e31d23" />
</Rule>
</Style>
<Style name="building_attachment_form">
<Rule>
<Filter>[building_attachment_form] = "Detached"</Filter>
<PolygonSymbolizer fill="#f2a2b9" />
</Rule>
<Rule>
<Filter>[building_attachment_form] = "Semi-Detached"</Filter>
<PolygonSymbolizer fill="#ab8fb0" />
</Rule>
<Rule>
<Filter>[building_attachment_form] = "End-Terrace"</Filter>
<PolygonSymbolizer fill="#3891d1" />
</Rule>
<Rule>
<Filter>[building_attachment_form] = "Mid-Terrace"</Filter>
<PolygonSymbolizer fill="#226291" />
</Rule>
</Style>
<Style name="likes">
<Rule>
<Filter>[likes] &gt;= 10</Filter>

View File

@ -371,6 +371,8 @@ const BUILDING_FIELD_WHITELIST = new Set([
// 'sust_aggregate_estimate_epc',
'sust_retrofit_date',
// 'sust_life_expectancy',
'building_attachment_form',
'date_change_building_use',
]);
/**

View File

@ -43,9 +43,9 @@ const BuildingView = (props) => {
return <TypeContainer
{...props}
key={props.building && props.building.building_id}
inactive={true}
inactive={false}
title="Type"
intro="How were buildings previously used? Coming soon…"
intro="How were buildings previously used?"
help="https://www.pages.colouring.london/buildingtypology"
/>
case 'age':

View File

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

View File

@ -1,23 +1,52 @@
import React, { Fragment } from 'react';
import withCopyEdit from '../data-container';
import SelectDataEntry from '../data-components/select-data-entry';
import NumericDataEntry from '../data-components/numeric-data-entry';
import DataEntry from '../data-components/data-entry';
const AttachmentFormOptions = [
"Detached",
"Semi-Detached",
"End-Terrace",
"Mid-Terrace"
];
/**
* Type view/edit section
*/
const TypeView = (props) => (
<Fragment>
<p className="data-intro">{props.intro}</p>
<ul>
<li>Original use (as constructed)</li>
{
// "disabled": true,
// "slug": "use_type_original",
// "type": "text"
}
</ul>
</Fragment>
)
const TypeView = (props) => {
const {mode, copy, onChange} = props;
const dataEntryProps = { mode, copy, onChange };
return (
<Fragment>
<SelectDataEntry
title="Building configuration (attachment)?"
slug="building_attachment_form"
value={props.building.building_attachment_form}
tooltip="We have prepopulated these based on their current attachment. A building can either be detached, semi-detached or part of a terrace (middle or end)"
options={AttachmentFormOptions}
{...dataEntryProps}
/>
<NumericDataEntry
title="When did use change?"
slug="date_change_building_use"
value={props.building.date_change_building_use}
tooltip="This is the date the building stopped being used for for the function it was built for. I.e. if it was Victorian warehouse which is now an office this would be when it became an office or if it was something before that, maybe a garage then the date that happened"
min={1086}
max={new Date().getFullYear()}
step={1}
{...dataEntryProps}
/>
<DataEntry
title="Original building use"
tooltip="What was the building originally used for when it was built? I.e. If it was Victorian warehouse which is now an office this would be warehouse"
disabled={true}
/>
</Fragment>
);
}
const TypeContainer = withCopyEdit(TypeView);
export default TypeContainer;

View File

@ -23,7 +23,12 @@ const LEGEND_CONFIG = {
},
type: {
title: 'Type',
elements: []
elements: [
{ color: "#f2a2b9", text: "Detached" },
{ color: "#ab8fb0", text: "Semi-Detached" },
{ color: "#3891d1", text: "End-Terrace" },
{ color: "#226291", text: "Mid-Terrace" }
]
},
age: {
title: 'Age',

View File

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

View File

@ -96,7 +96,17 @@ const BUILDING_LAYER_DEFINITIONS = {
buildings as b
WHERE
g.geometry_id = b.geometry_id
) as sust_dec`
) as sust_dec`,
building_attachment_form: `(
SELECT
b.building_attachment_form::text as building_attachment_form,
g.geometry_geom
FROM
geometries as g,
buildings as b
WHERE
g.geometry_id = b.geometry_id
) as building_attachment_form`,
};
const GEOMETRY_FIELD = 'geometry_geom';

View File

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