likes typology display

This commit is contained in:
Mateusz Konieczny 2023-02-07 10:31:43 +01:00
parent 5431f8528e
commit 26a330f743
12 changed files with 92 additions and 1 deletions

View File

@ -664,6 +664,47 @@
<LineSymbolizer stroke="#888" stroke-width="3.0"/>
</Rule>
</Style>
<Style name="typology_likes">
<Rule>
<Filter>[likes] &gt;= 100</Filter>
<PolygonSymbolizer fill="#bd0026" />
</Rule>
<Rule>
<Filter>[likes] &gt;= 50 and [likes] &lt; 100</Filter>
<PolygonSymbolizer fill="#e31a1c" />
</Rule>
<Rule>
<Filter>[likes] &gt;= 20 and [likes] &lt; 50</Filter>
<PolygonSymbolizer fill="#fc4e2a" />
</Rule>
<Rule>
<Filter>[likes] &gt;= 10 and [likes] &lt; 20</Filter>
<PolygonSymbolizer fill="#fd8d3c" />
</Rule>
<Rule>
<Filter>[likes] &gt;= 3 and [likes] &lt; 10</Filter>
<PolygonSymbolizer fill="#feb24c" />
</Rule>
<Rule>
<Filter>[likes] = 2</Filter>
<PolygonSymbolizer fill="#fed976" />
</Rule>
<Rule>
<Filter>[likes] = 1</Filter>
<PolygonSymbolizer fill="#ffe8a9" />
</Rule>
<Rule>
<MaxScaleDenominator>17061</MaxScaleDenominator>
<MinScaleDenominator>4264</MinScaleDenominator>
<LineSymbolizer stroke="#888" stroke-width="1.0"/>
</Rule>
<Rule>
<MaxScaleDenominator>4264</MaxScaleDenominator>
<MinScaleDenominator>0</MinScaleDenominator>
<LineSymbolizer stroke="#888" stroke-width="3.0"/>
</Rule>
</Style>
<Style name="community_local_significance_total">
<Rule>
<Filter>[community_local_significance_total] &gt;= 100</Filter>

View File

@ -19,6 +19,12 @@ export const aggregationsConfig: { [key in keyof typeof buildingUserAttributesCo
aggregationMethod: 'countTrue'
}
],
community_type_worth_keeping: [
{
aggregateFieldName: 'community_type_worth_keeping_total',
aggregationMethod: 'countTrue'
}
],
community_local_significance: [
{
aggregateFieldName: 'community_local_significance_total',

View File

@ -301,6 +301,11 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
derivedEdit: true,
verify: false
},
community_type_worth_keeping_total: {
edit: false,
derivedEdit: true,
verify: false
},
community_local_significance_total: {
edit: false,
derivedEdit: true,

View File

@ -97,6 +97,7 @@ const withCopyEdit: (wc: React.ComponentType<CategoryViewProps>) => DataContaine
'current_landuse_verified',
'planning_list_grade',
'likes_total',
'community_type_worth_keeping_total',
'community_local_significance_total',
'community_expected_planning_application_total'
]

View File

@ -28,6 +28,10 @@ const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => {
e.preventDefault();
props.onMapColourScale('likes')
}
const switchToTypologyMapStyle = (e) => {
e.preventDefault();
props.onMapColourScale('typology_likes')
}
const switchToLocalSignificanceMapStyle = (e) => {
e.preventDefault();
props.onMapColourScale('community_local_significance_total')
@ -117,6 +121,9 @@ const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => {
mode={props.mode}
/>
}
<button className={`map-switcher-inline ${props.mapColourScale == "likes" ? "enabled-state" : "disabled-state"} btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={switchToTypologyMapStyle}>
{(props.mapColourScale == "likes")? 'Showing likes for typologies (not about specific buildings)' : 'Click to see likes for typologies (not about specific buildings) mapped'}
</button>
<UserOpinionEntry

View File

@ -134,6 +134,21 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
]
}
},
{
mapStyle: 'typology_likes',
legend: {
title: 'Liked typologies',
elements: [
{ color: '#bd0026', text: '👍👍👍👍 100+' },
{ color: '#e31a1c', text: '👍👍👍 5099' },
{ color: '#fc4e2a', text: '👍👍 2049' },
{ color: '#fd8d3c', text: '👍👍 1019' },
{ color: '#feb24c', text: '👍 39' },
{ color: '#fed976', text: '👍 2' },
{ color: '#ffe8a9', text: '👍 1'}
]
}
},
{
mapStyle: 'community_local_significance_total',
legend: {

View File

@ -583,7 +583,11 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
example: 100,
tooltip: "People who like the building and think it contributes to the city.",
},
community_type_worth_keeping_total: {
category: Category.Community,
title: "People who think this type of building is contributes to the city.",
example: 100,
},
community_local_significance_total: {
category: Category.Community,
title: "People who think the building should be recorded as one of local significance",

View File

@ -9,6 +9,7 @@ export type BuildingMapTileset = 'date_year' |
'location' |
'is_domestic' |
'likes' |
'typology_likes' |
'community_local_significance_total' |
'community_expected_planning_application_total' |
'community_in_public_ownership' |

View File

@ -127,6 +127,14 @@ const LAYER_QUERIES = {
is_domestic <> 'yes'
AND
likes_total > 0`,
typology_likes: `
SELECT
geometry_id,
community_type_worth_keeping_total AS likes
FROM
buildings
WHERE
community_type_worth_keeping_total > 0`,
community_local_significance_total: `
SELECT
geometry_id,

View File

@ -55,6 +55,7 @@ COPY (SELECT
planning_local_list_url,
planning_historic_area_assessment_url,
is_domestic,
community_type_worth_keeping_total,
likes_total
FROM buildings)
TO '/tmp/building_attributes.csv'

View File

@ -1 +1,2 @@
ALTER TABLE buildings DROP COLUMN IF EXISTS is_domestic;
ALTER TABLE buildings DROP COLUMN IF EXISTS community_type_worth_keeping_total;

View File

@ -1 +1,2 @@
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS is_domestic text null;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS community_type_worth_keeping_total integer DEFAULT 0;