From 4dcd3de93a32c88ce0ea02a7a106835b848d6548 Mon Sep 17 00:00:00 2001 From: traveller195 <57902113+traveller195@users.noreply.github.com> Date: Wed, 8 Mar 2023 15:30:39 +0100 Subject: [PATCH] change data definiton for tile mapstyle of 'location' and 'team' using Subquery/ nested SQL Qquery to only load those buildings, having at least a few collected data. The benefit is, that the mapstyle is not different for nodata buildings comparing different data categories. Now, if you compare nodata buildings in 'team' or 'location' with others, the stroke width is larger than the normal map style... loading only builidings with data avoids this problem of different map styles. It is a better and more performant solution than changing it in polygon.xml see also https://github.com/colouring-cities/colouring-dresden/commit/c80f243c0d9f51dc436f2fe3916c7efb670f70d9 --- app/src/tiles/dataDefinition.ts | 82 ++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/app/src/tiles/dataDefinition.ts b/app/src/tiles/dataDefinition.ts index 66f2738c..d0dbfc0c 100644 --- a/app/src/tiles/dataDefinition.ts +++ b/app/src/tiles/dataDefinition.ts @@ -71,44 +71,52 @@ const LAYER_QUERIES = { WHERE construction_core_material IS NOT NULL`, location: ` - SELECT - geometry_id, - ( - case when location_name IS NULL then 0 else 1 end + - case when location_number IS NULL then 0 else 1 end + - case when location_street IS NULL then 0 else 1 end + - case when location_line_two IS NULL then 0 else 1 end + - case when location_town IS NULL then 0 else 1 end + - case when location_postcode IS NULL then 0 else 1 end + - case when location_latitude IS NULL then 0 else 1 end + - case when location_longitude IS NULL then 0 else 1 end + - case when ref_toid IS NULL then 0 else 1 end + - case when ref_osm_id IS NULL then 0 else 1 end - ) AS location_info_count - FROM - buildings`, + SELECT blds_with_data.* + FROM ( + SELECT + geometry_id, + ( + case when location_name IS NULL then 0 else 1 end + + case when location_number IS NULL then 0 else 1 end + + case when location_street IS NULL then 0 else 1 end + + case when location_line_two IS NULL then 0 else 1 end + + case when location_town IS NULL then 0 else 1 end + + case when location_postcode IS NULL then 0 else 1 end + + case when location_latitude IS NULL then 0 else 1 end + + case when location_longitude IS NULL then 0 else 1 end + + case when ref_toid IS NULL then 0 else 1 end + + case when ref_osm_id IS NULL then 0 else 1 end + ) AS location_info_count + FROM + buildings + ) AS blds_with_data + WHERE blds_with_data.location_info_count > 0`, team: ` - SELECT - geometry_id, - ( - case when has_extension IS NULL then 0 else 1 end + - case when extension_year IS NULL then 0 else 1 end + - case when developer_type IS NULL then 0 else 1 end + - case when developer_name IS NULL then 0 else 1 end + - case when developer_source_link IS NULL then 0 else 1 end + - case when designers IS NULL then 0 else 1 end + - case when designers_source_link IS NULL then 0 else 1 end + - case when lead_designer_type IS NULL then 0 else 1 end + - case when designer_awards IS NULL then 0 else 1 end + - case when awards_source_link IS NULL then 0 else 1 end + - case when builder IS NULL then 0 else 1 end + - case when builder_source_link IS NULL then 0 else 1 end + - case when other_team IS NULL then 0 else 1 end + - case when other_team_source_link IS NULL then 0 else 1 end + - case when date_year IS NULL then 0 else 1 end - ) AS team_info_count - FROM - buildings`, + SELECT blds_with_data.* + FROM ( + SELECT + geometry_id, + ( + case when has_extension IS NULL then 0 else 1 end + + case when extension_year IS NULL then 0 else 1 end + + case when developer_type IS NULL then 0 else 1 end + + case when developer_name IS NULL then 0 else 1 end + + case when developer_source_link IS NULL then 0 else 1 end + + case when designers IS NULL then 0 else 1 end + + case when designers_source_link IS NULL then 0 else 1 end + + case when lead_designer_type IS NULL then 0 else 1 end + + case when designer_awards IS NULL then 0 else 1 end + + case when awards_source_link IS NULL then 0 else 1 end + + case when builder IS NULL then 0 else 1 end + + case when builder_source_link IS NULL then 0 else 1 end + + case when other_team IS NULL then 0 else 1 end + + case when other_team_source_link IS NULL then 0 else 1 end + + case when date_year IS NULL then 0 else 1 end + ) AS team_info_count + FROM + buildings + ) AS blds_with_data + WHERE blds_with_data.team_info_count > 0`, is_domestic: ` SELECT geometry_id,