Python_scripts/5_GEONATURE/EXPORT/v_eee_n2000_platiere.py
2026-04-28 14:17:26 +02:00

42 lines
1.9 KiB
Python

from pycen import con_gn
sql = '''
DROP VIEW IF EXISTS gn_exports.v_eee_n2000_platiere;
CREATE OR REPLACE VIEW gn_exports.v_eee_n2000_platiere
AS
SELECT
v.*
FROM gn_synthese.v_synthese_for_export v
JOIN ref_geo.l_areas ON st_intersects(ST_GeomFromGeoJSON(v.geojson_4326),st_transform(l_areas.geom,4326))
JOIN ref_geo.bib_areas_types bib USING (id_type)
WHERE bib.type_code = 'ZPS'
AND area_name ilike '%%plati%%re%%'
AND v.cd_ref in (100330, 101055, 101237, 101286, 103139, 103543, 103545, 103547,
103557, 104074, 104805, 105017, 105433, 105615, 105689, 105960,
106252, 106571, 106742, 106748, 106754, 106965, 107446, 108628,
108642, 108810, 109141, 109911, 109926, 109954, 109980, 110762,
111863, 111881, 112100, 112111, 112130, 112195, 112463, 112467,
112482, 112712, 112790, 113418, 114024, 115527, 116089, 116137,
116485, 117503, 117505, 117723, 117860, 117937, 118477, 119474,
119558, 119595, 119854, 122630, 124025, 124164, 124168, 124378,
124635, 124646, 124719, 124730, 125331, 128504, 128748, 128863,
128954, 129468, 130484, 130491, 159690, 159937, 4419, 446169,
448413, 454932, 4872, 611690, 611753, 612522, 717136, 717180,
79766, 79877, 80086, 80824, 81955, 81978, 82018, 82080,
82093, 82164, 83938, 84057, 84251, 85186, 85469, 85949,
85957, 86167, 86513, 86817, 86869, 86975, 89452, 90192,
90234, 92572, 92649, 92663, 92793, 93020, 93129, 93613,
93923, 93924, 94168, 94489, 95679, 95823, 95831, 95965,
95975, 95980, 96149, 96585, 96644, 96739, 96749, 96775,
97346, 97594, 97666, 97961, 99260, 99359, 95983, 96814,
117507, 129959, 81992, 90532, 97623, 104353, 111886, 112483,
125369, 109037, 96624, 101056, 106800, 109949, 116762, 125324
)
;
'''
with con_gn.begin() as cnx:
cnx.execute(sql)