Last active
October 22, 2020 10:08
-
-
Save cquest/5261e4cba5f0bc91a1da17b482830791 to your computer and use it in GitHub Desktop.
Script de génération des fichiers géographiques des zones couvertes par le couvre-feu sanitaire
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# download limites géographiques des communes | |
wget -N http://data.cquest.org/ign/adminexpress/ADMIN-EXPRESS_2-4__SHP__FRA_L93_2020-09-15.7z | |
7z x ADMIN-EXPRESS_2-4__SHP__FRA_L93_2020-09-15.7z | |
# import dans une base locale postgresql/postgis pour traitements géo | |
ogr2ogr -f pgdump /vsistdout/ -t_srs EPSG:4326 -nln admin_express_communes -nlt geometry ADMIN-EXPRESS_2-4__SHP__FRA_2020-09-15/ADMIN-EXPRESS/1_DONNEES_LIVRAISON_2020-09-15/ADE_2-4_SHP_LAMB93_FR/COMMUNE.shp | psql | |
# métropoles et régions concernées | |
METROPOLES="'Lille','Lyon','Marseille','Saint-Étienne','Toulouse','Montpellier','Grenoble'" | |
REGIONS="'11'" | |
# communes supplémentaires | |
COMMUNES="'Montarnaud','Mauguio','Palavas-les-Flots','Teyran','Saint-Aunès','Saint-Clément-de-Rivière','Saint-Gély-du-Fesc','Labège','Ramonville-Saint-Agne','Auzeville-Tolosane','Castanet-Tolosan','Portet-sur-Garonne','Plaisance-du-Touch','Amfreville-la-Mi-Voie','Belbeuf','Bihorel','Bonsecours','Bois-Guillaume','Canteleu','Caudebec-lès-Elbeuf','Cléon','Darnétal','Déville-lès-Rouen','Elbeuf','Franqueville-Saint-Pierre','Grand-Couronne','Houppeville','Isneauville','Le Grand-Quevilly','Le Houlme','Le Mesnil-Esnard','Le Petit-Quevilly','Malaunay','Maromme','Mont-Saint-Aignan','Notre-Dame-de-Bondeville','Oissel','Orival','Petit-Couronne','Rouen','Saint-Aubin-lès-Elbeuf','Saint-Étienne-du-Rouvray','Saint-Léger-du-Bourg-Denis','Saint-Pierre-lès-Elbeuf','Sotteville-lès-Rouen','Tourville-la-Rivière','Allennes-les-Marais','Annœullin','Bauvin','Carnin','Provin'" | |
# communes à exclure | |
SAUF="'Pertuis','Saint-Zacharie','16252'" | |
# export fichier geojson (communes séparées) | |
rm -f couvre_feu_communes.geojson | |
ogr2ogr -f geojson couvre_feu_communes.geojson PG:dbname=$USER -sql " | |
select * from admin_express_communes | |
where (code_epci in (select code_epci from admin_express_communes where nom_com in ($METROPOLES)) | |
or insee_reg in ($REGIONS) | |
or nom_com in ($COMMUNES)) | |
AND nom_com NOT in ($SAUF) | |
AND insee_com NOT in ($SAUF)" | |
# export fichier geojson (communes regreoupées) | |
rm -f couvre_feu_zones.geojson | |
ogr2ogr -f geojson couvre_feu_zones.geojson PG:dbname=$USER -sql " | |
select st_union(wkb_geometry) from admin_express_communes | |
where (code_epci in (select code_epci from admin_express_communes where nom_com in ($METROPOLES)) | |
or insee_reg in ($REGIONS) | |
or nom_com in ($COMMUNES)) | |
AND nom_com NOT in ($SAUF) | |
AND insee_com NOT in ($SAUF)" | |
cp *.geojson /mnt/zfs72/opendatarchives/data.cquest.org/covid/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment