Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Last active September 18, 2024 18:15
Show Gist options
  • Save ThomasG77/038cb44cfb789cc19798be3840e7bfcd to your computer and use it in GitHub Desktop.
Save ThomasG77/038cb44cfb789cc19798be3840e7bfcd to your computer and use it in GitHub Desktop.
Génération GeoJSON Territoires d'industrie

Recipe to generate "Territoires d'industrie areas"

Data from https://www.data.gouv.fr/fr/datasets/programme-territoires-dindustrie/

wget https://static.data.gouv.fr/resources/programme-territoires-dindustrie/20240704-091848/liste-ti-com2023-20240704.csv # 2023-2027
wget https://static.data.gouv.fr/resources/programme-territoires-dindustrie/20230802-130420/liste-ti-com2023-20230802.csv # 2018-2023
wget https://files.opendatarchives.fr/professionnels.ign.fr/adminexpress/ADMIN-EXPRESS-COG_3-2__SHP_WGS84G_FRA_2023-05-03.7z
7z e ADMIN-EXPRESS-COG_3-2__SHP_WGS84G_FRA_2023-05-03.7z COMMUNE.* -r -aoa

# Merging communes for 2018-2023
mapshaper COMMUNE.shp -join liste-ti-com2023-20230802.csv keys=INSEE_COM,insee_com string-fields=INSEE_COM,insee_com,id_ti,lib_ti unjoined unmatched -filter 'id_ti != null' -dissolve fields=id_ti copy-fields=id_ti,lib_ti -o ti-com2023-2018-2023.geojson
mapshaper COMMUNE.shp -join liste-ti-com2023-20230802.csv keys=INSEE_COM,insee_com string-fields=INSEE_COM,insee_com,id_ti,lib_ti unjoined unmatched -filter 'id_ti != null' -dissolve fields=id_ti copy-fields=id_ti,lib_ti -simplify keep-shapes interval=5 -o ti-com2023-2018-2023-5m.geojson
mapshaper COMMUNE.shp -join liste-ti-com2023-20230802.csv keys=INSEE_COM,insee_com string-fields=INSEE_COM,insee_com,id_ti,lib_ti unjoined unmatched -filter 'id_ti != null' -dissolve fields=id_ti copy-fields=id_ti,lib_ti -simplify keep-shapes interval=50 -o ti-com2023-2018-2023-50m.geojson

# Merging communes for 2023-2027
mapshaper COMMUNE.shp -join liste-ti-com2023-20240704.csv keys=INSEE_COM,insee_com string-fields=INSEE_COM,insee_com,id_ti,lib_ti unjoined unmatched -filter 'id_ti != null' -dissolve fields=id_ti copy-fields=id_ti,lib_ti -o ti-com2023-2023-2027.geojson
mapshaper COMMUNE.shp -join liste-ti-com2023-20240704.csv keys=INSEE_COM,insee_com string-fields=INSEE_COM,insee_com,id_ti,lib_ti unjoined unmatched -filter 'id_ti != null' -dissolve fields=id_ti copy-fields=id_ti,lib_ti -simplify keep-shapes interval=5 -o ti-com2023-2023-2027-5m.geojson
mapshaper COMMUNE.shp -join liste-ti-com2023-20240704.csv keys=INSEE_COM,insee_com string-fields=INSEE_COM,insee_com,id_ti,lib_ti unjoined unmatched -filter 'id_ti != null' -dissolve fields=id_ti copy-fields=id_ti,lib_ti -simplify keep-shapes interval=50 -o ti-com2023-2023-2027-50m.geojson

du -cksh ti-com*.geojson # Below output

# 7,3M    ti-com2023-2018-2023-50m.geojson
# 36M ti-com2023-2018-2023-5m.geojson
# 78M ti-com2023-2018-2023.geojson
# 8,6M    ti-com2023-2023-2027-50m.geojson
# 44M ti-com2023-2023-2027-5m.geojson
# 96M ti-com2023-2023-2027.geojson
# 268M    total
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
View raw

(Sorry about that, but we can’t show files that are this big right now.)

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment