new test layers

This commit is contained in:
Mateusz Konieczny 2022-11-05 08:50:47 +01:00
parent 2ed84f1148
commit adbe79727a
5 changed files with 113 additions and 2 deletions

View File

@ -313,6 +313,43 @@
<PolygonSymbolizer fill="#73ebaf" /> <PolygonSymbolizer fill="#73ebaf" />
</Rule> </Rule>
</Style> </Style>
<Style name="planning_applications_status_all">
<Rule>
<Filter>[status] = "Submitted"</Filter>
<PolygonSymbolizer fill="#53f5dd"/>
<LineSymbolizer stroke="#53f5dd" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] = "Approved"</Filter>
<PolygonSymbolizer fill="#16cf15"/>
<LineSymbolizer stroke="#16cf15" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] = "Appeal In Progress"</Filter>
<PolygonSymbolizer fill="#fff200"/>
<LineSymbolizer stroke="#fff200" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] = "Rejected"</Filter>
<PolygonSymbolizer fill="#e31d23"/>
<LineSymbolizer stroke="#e31d23" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] = "Withdrawn"</Filter>
<PolygonSymbolizer fill="#999999"/>
<LineSymbolizer stroke="#999999" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] = "Withdrawn"</Filter>
<PolygonSymbolizer fill="#262626"/>
<LineSymbolizer stroke="#262626" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] != "Submitted" and [status] != "Approved" and [status] != "Appeal In Progress" and [status] != "Rejected" and [status] != "Withdrawn"</Filter>
<PolygonSymbolizer fill="#eacad0"/>
<LineSymbolizer stroke="#eacad0" stroke-width="1.75" />
</Rule>
</Style>
<Style name="planning_applications_status"> <Style name="planning_applications_status">
<Rule> <Rule>
<Filter>[status] = "Submitted" and [days_since_registered_with_local_authority_date] &lt; 366</Filter> <Filter>[status] = "Submitted" and [days_since_registered_with_local_authority_date] &lt; 366</Filter>
@ -375,6 +412,38 @@
<LineSymbolizer stroke="#2f282a" stroke-width="1.75" /> <LineSymbolizer stroke="#2f282a" stroke-width="1.75" />
</Rule> </Rule>
</Style> </Style>
<Style name="planning_applications_status_recent">
<Rule>
<Filter>[status] = "Submitted" and [days_since_registered_with_local_authority_date] &lt; 366</Filter>
<PolygonSymbolizer fill="#53f5dd"/>
<LineSymbolizer stroke="#53f5dd" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] = "Approved" and [days_since_decision_date] &lt; 366</Filter>
<PolygonSymbolizer fill="#16cf15"/>
<LineSymbolizer stroke="#16cf15" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] = "Appeal In Progress" and [days_since_decision_date] &lt; 366</Filter>
<PolygonSymbolizer fill="#fff200"/>
<LineSymbolizer stroke="#fff200" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] = "Rejected" and [days_since_decision_date] &lt; 366</Filter>
<PolygonSymbolizer fill="#e31d23"/>
<LineSymbolizer stroke="#e31d23" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] = "Withdrawn" and [days_since_registered_with_local_authority_date] &lt; 366</Filter>
<PolygonSymbolizer fill="#999999"/>
<LineSymbolizer stroke="#999999" stroke-width="1.75" />
</Rule>
<Rule>
<Filter>[status] != "Submitted" and [status] != "Approved" and [status] != "Appeal In Progress" and [status] != "Rejected" and [status] != "Withdrawn" and [days_since_registered_with_local_authority_date] &lt; 366</Filter>
<PolygonSymbolizer fill="#eacad0"/>
<LineSymbolizer stroke="#eacad0" stroke-width="1.75" />
</Rule>
</Style>
<Style name="planning_combined"> <Style name="planning_combined">
<Rule> <Rule>
<Filter>[planning_in_conservation_area] = true</Filter> <Filter>[planning_in_conservation_area] = true</Filter>

View File

@ -3,7 +3,7 @@ import db from '../../../db';
export async function getBuildingPlanningDataById(id: number) { export async function getBuildingPlanningDataById(id: number) {
try { try {
return await db.any( return await db.any(
'SELECT building_properties.uprn, building_properties.building_id, planning_data.description, planning_data.status, planning_data.uprn, planning_data.planning_application_id, planning_application_link, to_char(planning_data.registered_with_local_authority_date, \'YYYY-MM-DD\') AS registered_with_local_authority_date, to_char(planning_data.decision_date, \'YYYY-MM-DD\') AS decision_date, to_char(planning_data.last_synced_date, \'YYYY-MM-DD\') AS last_synced_date, planning_data.data_source, planning_data.data_source_link \ 'SELECT building_properties.uprn, building_properties.building_id, planning_data.description, planning_data.status, planning_data.status_before_aliasing, planning_data.uprn, planning_data.planning_application_id, planning_application_link, to_char(planning_data.registered_with_local_authority_date, \'YYYY-MM-DD\') AS registered_with_local_authority_date, to_char(planning_data.decision_date, \'YYYY-MM-DD\') AS decision_date, to_char(planning_data.last_synced_date, \'YYYY-MM-DD\') AS last_synced_date, planning_data.data_source, planning_data.data_source_link \
FROM building_properties \ FROM building_properties \
INNER JOIN planning_data ON \ INNER JOIN planning_data ON \
building_properties.uprn = planning_data.uprn WHERE building_id = $1', building_properties.uprn = planning_data.uprn WHERE building_id = $1',

View File

@ -168,10 +168,38 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
} }
], ],
[Category.Planning]: [ [Category.Planning]: [
{
mapStyle: 'planning_applications_status_all',
legend: {
title: 'All planning applications',
elements: [
{ color: '#53f5dd', text: 'Submitted, awaiting decision' },
{ color: '#fff200', text: 'Appeal In Progress' },
{ color: '#16cf15', text: 'Approved' },
{ color: '#e31d23', text: 'Rejected' },
{ color: '#999999', text: 'Withdrawn' },
{ color: '#eacad0', text: 'Other' },
]
}
},
{
mapStyle: 'planning_applications_status_recent',
legend: {
title: 'Recent planning applications',
elements: [
{ color: '#53f5dd', text: 'Submitted, awaiting decision' },
{ color: '#fff200', text: 'Appeal In Progress' },
{ color: '#16cf15', text: 'Approved' },
{ color: '#e31d23', text: 'Rejected' },
{ color: '#999999', text: 'Withdrawn' },
{ color: '#eacad0', text: 'Other' },
]
}
},
{ {
mapStyle: 'planning_applications_status', mapStyle: 'planning_applications_status',
legend: { legend: {
title: 'Planning applications', title: 'All planning applications, old ones with a dark styling',
elements: [ elements: [
{ color: '#53f5dd', text: 'Submitted, awaiting decision' }, { color: '#53f5dd', text: 'Submitted, awaiting decision' },
{ color: '#fff200', text: 'Appeal In Progress' }, { color: '#fff200', text: 'Appeal In Progress' },

View File

@ -11,6 +11,8 @@ export type BuildingMapTileset = 'date_year' |
'community_local_significance_total' | 'community_local_significance_total' |
'community_expected_planning_application_total' | 'community_expected_planning_application_total' |
'community_in_public_ownership' | 'community_in_public_ownership' |
'planning_applications_status_all' |
'planning_applications_status_recent' |
'planning_applications_status' | 'planning_applications_status' |
'planning_combined' | 'planning_combined' |
'sust_dec' | 'sust_dec' |

View File

@ -136,6 +136,18 @@ const LAYER_QUERIES = {
WHERE WHERE
community_public_ownership IS NOT NULL community_public_ownership IS NOT NULL
`, `,
planning_applications_status_all: `SELECT
buildings.geometry_id, building_properties.uprn, building_properties.building_id, planning_data.status AS status, planning_data.uprn,
FROM building_properties
INNER JOIN planning_data ON building_properties.uprn = planning_data.uprn
INNER JOIN buildings ON building_properties.building_id = buildings.building_id`,
planning_applications_status_recent: `SELECT
buildings.geometry_id, building_properties.uprn, building_properties.building_id, planning_data.status AS status, planning_data.uprn,
EXTRACT(epoch FROM age(decision_date))/3600/24 AS days_since_decision_date,
EXTRACT(epoch FROM age(registered_with_local_authority_date))/3600/24 AS days_since_registered_with_local_authority_date
FROM building_properties
INNER JOIN planning_data ON building_properties.uprn = planning_data.uprn
INNER JOIN buildings ON building_properties.building_id = buildings.building_id`,
planning_applications_status: `SELECT planning_applications_status: `SELECT
buildings.geometry_id, building_properties.uprn, building_properties.building_id, planning_data.status AS status, planning_data.uprn, buildings.geometry_id, building_properties.uprn, building_properties.building_id, planning_data.status AS status, planning_data.uprn,
EXTRACT(epoch FROM age(decision_date))/3600/24 AS days_since_decision_date, EXTRACT(epoch FROM age(decision_date))/3600/24 AS days_since_decision_date,