From 7a2830f96d5ec556b697d9f7012af80d69175207 Mon Sep 17 00:00:00 2001 From: Maxime Vergez Date: Wed, 12 Oct 2022 15:38:08 +0200 Subject: [PATCH] feat(db): filter out vm_l_areas with intersection And exclude M1,M5,M10,COM (COM must be removed when vm_l_areas will be used for COM also) --- data/atlas_with_extended_areas.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/atlas_with_extended_areas.sql b/data/atlas_with_extended_areas.sql index e9914c153..dad32a0c0 100644 --- a/data/atlas_with_extended_areas.sql +++ b/data/atlas_with_extended_areas.sql @@ -30,9 +30,11 @@ FROM ref_geo.l_areas a JOIN atlas.vm_bib_areas_types t ON t.id_type = a.id_type + JOIN atlas.t_layer_territoire tlt + ON st_intersects(st_transform(a.geom, 4326) , tlt.the_geom) WHERE enable = TRUE AND - type_code IN ('M10', 'COM', 'ZNIEFF1', 'ZNIEFF2') + t.type_code NOT IN ('M1', 'M5', 'M10', 'COM') WITH DATA; CREATE UNIQUE INDEX vm_l_areas_id_area_idx