Skip to content

Commit

Permalink
Update expand_facade_geometries.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentAntoine committed Jun 21, 2023
1 parent 0c726cf commit 009b033
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@

CREATE TABLE prod.facade_areas AS

WITH facades_polygons_without_holes AS (
WITH other_unexpanded_facades AS (
SELECT
f1.facade,
ST_UNION(CASE WHEN f2.facade = f1.facade THEN NULL ELSE f2.geom END) as other_facades_geom
FROM prod.facade_areas_unextended f1
CROSS JOIN prod.facade_areas_unextended f2
GROUP BY f1.facade
),

facades_polygons_without_holes AS (
-- Split les Multipolygon en Polygons avec ST_Dump puis
-- bouche les trous (îles) dans les polygones avec ST_ExteriorRing.
SELECT
id,
facade,
ST_MakePolygon(ST_ExteriorRing((ST_Dump(geom)).geom)) AS geom
prod.facade_areas_unextended.facade,
ST_Difference(ST_MakePolygon(ST_ExteriorRing((ST_Dump(geom)).geom)), other_facades_geom) AS geom
FROM prod.facade_areas_unextended
JOIN other_unexpanded_facades
ON prod.facade_areas_unextended.facade = other_unexpanded_facades.facade
),

facades_multipolygons AS (
Expand Down

0 comments on commit 009b033

Please sign in to comment.