Created
July 21, 2022 12:59
-
-
Save ThomasG77/45b4a3866a6b2fb1b634d9930ca57546 to your computer and use it in GitHub Desktop.
Generation GeoJSON des mairies avec code INSEE
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
wget -N -P data/ http://files.opendatarchives.fr/professionnels.ign.fr/adminexpress/ADMIN-EXPRESS-COG_3-1__SHP__FRA_WM_2022-04-15.7z | |
cd data | |
7z e ADMIN-EXPRESS-COG_3-1__SHP__FRA_WM_2022-04-15.7z CHFLIEU_COMMUNE.* COMMUNE.* -r | |
ogr2ogr -overwrite \ | |
-f GeoJSON \ | |
-dialect SQLite \ | |
-sql "SELECT \"INSEE_COM\", CASE WHEN chf.geometry IS NULL THEN 'c' ELSE 'm' END AS t, CASE WHEN chf.geometry IS NULL THEN PointOnSurface(\"COMMUNE\".geometry) ELSE chf.geometry END AS geometry FROM \"COMMUNE\" LEFT JOIN 'CHFLIEU_COMMUNE.shp'.\"CHFLIEU_COMMUNE\" chf ON chf.\"ID_COM\" = \"COMMUNE\".\"ID\"" \ | |
chflieu_commune.geojson \ | |
COMMUNE.shp \ | |
-lco RFC7946=YES \ | |
-lco WRITE_NAME=NO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment