This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch colorfull-extrusions
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git


The following commit(s) were added to refs/heads/colorfull-extrusions by this 
push:
     new 6f80f822 Improve queries
6f80f822 is described below

commit 6f80f8221b908e6c129bb51a78533469c7b48f21
Author: Bertil Chapuis <[email protected]>
AuthorDate: Thu Oct 26 11:58:14 2023 +0200

    Improve queries
---
 basemap/layers/building/extrusion.js | 11 +++++++-
 basemap/layers/building/tileset.js   | 54 +++++++++++++++++++++---------------
 2 files changed, 41 insertions(+), 24 deletions(-)

diff --git a/basemap/layers/building/extrusion.js 
b/basemap/layers/building/extrusion.js
index 2c28e5ed..9da8d3a9 100644
--- a/basemap/layers/building/extrusion.js
+++ b/basemap/layers/building/extrusion.js
@@ -21,7 +21,15 @@ export default {
     type: 'fill-extrusion',
     source: 'baremaps',
     'source-layer': 'building',
-    filter: ['!=', ['get', 'building'], 'no'],
+    filter: [
+        'all',
+        ['!', ['has', 'layer']],
+        [
+            'any',
+            ['!=', ['get', 'building'], 'no'],
+            ['==', ['get', 'building:part'], 'yes'],
+        ]    
+    ],
     layout: {
         visibility: 'visible',
     },
@@ -33,6 +41,7 @@ export default {
             ["get", "building:colour"],
             theme.buildingShapeFillColor,
         ],
+        //"fill-extrusion-color": theme.buildingShapeFillColor,
         "fill-extrusion-base": [
             'interpolate',
             ['linear'],
diff --git a/basemap/layers/building/tileset.js 
b/basemap/layers/building/tileset.js
index 47c962e1..96537507 100644
--- a/basemap/layers/building/tileset.js
+++ b/basemap/layers/building/tileset.js
@@ -26,21 +26,25 @@ export default {
                     id, 
                     tags
                         || jsonb_build_object('extrusion:base', (CASE
-                                                                     WHEN tags 
? 'building:min_height'
-                                                                         THEN 
tags ->> 'building:min_height'
-                                                                     WHEN tags 
->> 'building:min_level' ~ '^[0-9\\\\\\\\.]+$'
-                                                                         THEN 
tags ->> 'building:min_level'
-                                                                     ELSE '0' 
END)::real * 3)
+                            WHEN tags ? 'building:min_height'
+                                THEN (tags ->> 'building:min_height')::real
+                            WHEN tags ->> 'building:min_level' ~ 
'^[0-9\\\\\\\\.]+$'
+                                THEN (tags ->> 'building:min_level')::real * 3
+                            ELSE '0' END)::real)
                         || jsonb_build_object('extrusion:height', (CASE
-                                                                   WHEN tags ? 
'building:height'
-                                                                       THEN 
tags ->> 'building:height'
-                                                                   WHEN tags 
->> 'building:levels' ~ '^[0-9\\\\\\\\.]+$'
-                                                                       THEN 
tags ->> 'building:levels'
-                                                                   ELSE '2' 
END)::real * 3),
-                    geom 
+                            WHEN tags ? 'height'
+                                THEN (split_part(regexp_replace(replace(tags 
->> 'height', ',', '.'), '[A-Za-z]', ''), ';', 1))::real
+                            WHEN tags ? 'building:height'
+                                THEN (tags ->> 'building:height')::real
+                            WHEN tags ->> 'building:levels' ~ 
'^[0-9\\\\\\\\.]+$'
+                                THEN (tags ->> 'building:levels')::real * 3
+                            ELSE '2' END)::real),
+                        geom
                 FROM osm_ways 
-                WHERE tags ? 'building'`,
+                WHERE tags ? 'building' 
+                OR tags ? 'building:part'`,
         },
+        /*
         {
             minzoom: 13,
             maxzoom: 20,
@@ -49,20 +53,24 @@ export default {
                     id, 
                     tags 
                         || jsonb_build_object('extrusion:base', (CASE
-                                                                      WHEN 
tags ? 'building:min_height'
-                                                                          THEN 
tags ->> 'building:min_height'
-                                                                      WHEN 
tags ->> 'building:min_level' ~ '^[0-9\\\\\\\\.]+$'
-                                                                          THEN 
tags ->> 'building:min_level'
-                                                                      ELSE '0' 
END)::real * 3)
+                            WHEN tags ? 'building:min_height'
+                                THEN (tags ->> 'building:min_height')::real
+                            WHEN tags ->> 'building:min_level' ~ 
'^[0-9\\\\\\\\.]+$'
+                                THEN (tags ->> 'building:min_level')::real * 3
+                            ELSE '0' END)::real)
                         || jsonb_build_object('extrusion:height', (CASE
-                                                                   WHEN tags ? 
'building:height'
-                                                                       THEN 
tags ->> 'building:height'
-                                                                   WHEN tags 
->> 'building:levels' ~ '^[0-9\\\\\\\\.]+$'
-                                                                       THEN 
tags ->> 'building:levels'
-                                                                   ELSE '2' 
END)::real * 3),
+                            WHEN tags ? 'height'
+                                THEN (split_part(regexp_replace(replace(tags 
->> 'height', ',', '.'), '[A-Za-z]', ''), ';', 1))::real
+                            WHEN tags ? 'building:height'
+                                THEN (tags ->> 'building:height')::real
+                            WHEN tags ->> 'building:levels' ~ 
'^[0-9\\\\\\\\.]+$'
+                                THEN (tags ->> 'building:levels')::real * 3
+                            ELSE '2' END)::real),
                     geom 
                 FROM osm_relations 
-                WHERE tags ? 'building'`,
+                WHERE tags ? 'building' 
+                OR tags ? 'building:part'`,
         },
+        */
     ],
 }

Reply via email to