From d111661f2e9d21860274bbf1cacea117bac41078 Mon Sep 17 00:00:00 2001 From: wjtje <33957974+wjtje@users.noreply.github.com> Date: Thu, 6 Oct 2022 14:28:36 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Show=20buildings=20from=20OSM=20-?= =?UTF-8?q?=20Show=20overlapping=20buildings=20-=20Show=20imported=20build?= =?UTF-8?q?ings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/themes/bag_import/bag.json | 148 ++++++++++++++++++++++++++---- 1 file changed, 130 insertions(+), 18 deletions(-) diff --git a/assets/themes/bag_import/bag.json b/assets/themes/bag_import/bag.json index efd997f68..aafd3927a 100644 --- a/assets/themes/bag_import/bag.json +++ b/assets/themes/bag_import/bag.json @@ -11,7 +11,6 @@ }, "maintainer": "Wouter van der Wal", "icon": "./assets/themes/bag_import/logo.svg", - "version": "0", "startLat": 53.1726, "startLon": 7.04545, "startZoom": 9, @@ -20,32 +19,135 @@ }, "layers": [ { - "id": "bag:pand", - "name": "bag:pand", - "title": "bag:pand - {identificatie}", - "description": "Gebouwen vanaf het bag register", + "id": "osm:buildings", + "name": "OSM buildings", + "title": "OSM building", "source": { - "geoJson": "https://service.pdok.nl/lv/bag/wfs/v2_0?request=GetFeature&service=WFS&version=2.0.0&outputFormat=application%2Fjson%3B%20subtype%3Dgeojson&typeName=bag%3Apand&bbox={x_min}%2C{y_min}%2C{x_max}%2C{y_max}%2CCRS84&srsName=EPSG%3A4326", - "geoJsonZoomLevel": 18, - "osmTags": { - "and": ["identificatie~*"] - }, + "osmTags": "building~*", "maxCacheAge": 0 }, "calculatedTags": [ - "_osm_obj:building=(feat.properties.status.startsWith('Bouwvergunning verleend') || feat.properties.status.startsWith('Bouw gestart')) ? 'construction' : ((feat.properties.status.startsWith('Pand in gebruik') && feat.properties.gebruiksdoel == 'woonfunctie') ? ((Number(feat.properties.aantal_verblijfsobjecten) == 1) ? 'house' : 'apartments') : 'yes')" + "_surface:strict:=feat.get('_surface')" ], "mapRendering": [ { "width": { - "render": 5 + "render": "2", + "mappings": [ + { + "if": "fixme~*", + "then": "5" + } + ] }, "color": { - "render": "#00a" + "render": "#00c", + "mappings": [ + { + "if": "fixme~*", + "then": "#ff00ff" + }, + { + "if": "building=house", + "then": "#a00" + }, + { + "if": "building=shed", + "then": "#563e02" + }, + { + "if": { + "or": [ + "building=garage", + "building=garages" + ] + }, + "then": "#f9bfbb" + }, + { + "if": "building=yes", + "then": "#0774f2" + } + ] } } ] }, + { + "id": "bag:pand", + "name": "bag:pand", + "title": "bag:pand - {identificatie}", + "description": { + "en": "Building from BAG register" + }, + "source": { + "geoJson": "https://service.pdok.nl/lv/bag/wfs/v2_0?request=GetFeature&service=WFS&version=2.0.0&outputFormat=application%2Fjson%3B%20subtype%3Dgeojson&typeName=bag%3Apand&bbox={x_min}%2C{y_min}%2C{x_max}%2C{y_max}%2CCRS84&srsName=EPSG%3A4326", + "geoJsonZoomLevel": 18, + "osmTags": { + "and": [ + "identificatie~*" + ] + }, + "maxCacheAge": 0 + }, + "calculatedTags": [ + "_overlaps_with_buildings=feat.overlapWith('osm:buildings').filter(f => f.feat.properties.id.indexOf('-') < 0)", + "_overlaps_with=feat.get('_overlaps_with_buildings').find(f => f.overlap > 1 /* square meter */ )", + "_overlaps_with_properties=feat.get('_overlaps_with')?.feat?.properties", + + "_overlap_percentage=Math.round(100 * (feat.get('_overlaps_with')?.overlap / feat.get('_overlaps_with_properties')['_surface:strict']))", + "_reverse_overlap_percentage=Math.round(100 * (feat.get('_overlaps_with')?.overlap / feat.get('_surface')))", + + "_bag_obj:building=(feat.properties.status.startsWith('Bouwvergunning verleend') || feat.properties.status.startsWith('Bouw gestart')) ? 'construction' : ((feat.properties.status.startsWith('Pand in gebruik') && feat.properties.gebruiksdoel == 'woonfunctie') ? ((Number(feat.properties.aantal_verblijfsobjecten) == 1) ? 'house' : 'apartments') : 'yes')", + "_bag_obj:start_date=feat.properties.bouwjaar", + + "_osm_obj:id=feat.get('_overlaps_with_properties')?.id", + "_osm_obj:building=feat.get('_overlaps_with_properties')?.building", + + "_imported_osm_object_found=Number(feat.properties.identificatie)==Number(feat.get('_overlaps_with_properties')['ref:bag'])" + ], + "mapRendering": [ + { + "width": { + "render": 5, + "mappings": [ + { + "if": "_imported_osm_object_found=true", + "then": "1" + } + ] + }, + "color": { + "render": "#00a", + "mappings": [ + { + "if": "_imported_osm_object_found=true", + "then": "#0f0" + } + ] + } + } + ], + "tagRenderings": [ + { + "id": "Build year", + "render": { + "en": "This building was build in {_bag_obj:start_date}" + } + }, + { + "id": "Building type", + "render": { + "en": "The building type is a {_bag_obj:building}" + } + }, + { + "id": "Overlapping building", + "render": "