COUNTRIES = {
"AT": "Autriche",
"BE": "Belgique",
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
{ | |
"name": "order-service", | |
"version": "0.0.2", | |
"lockfileVersion": 2, | |
"requires": true, | |
"packages": { | |
"": { | |
"name": "order-service", | |
"version": "0.0.2", | |
"license": "ISC", |
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 \ |
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 https://sig.ville.gouv.fr/Atlas/qp-politiquedelaville-shp.zip | |
unzip qp-politiquedelaville-shp.zip | |
ogrinfo QP_METROPOLEOUTREMER_WGS84_EPSG4326.shp -dialect SQLite -sql "SELECT count(*) FROM \"QP_METROPOLEOUTREMER_WGS84_EPSG4326\" WHERE NOT IsValid(geometry)" | |
ogr2ogr out.shp QP_METROPOLEOUTREMER_WGS84_EPSG4326.shp -dialect SQLite -sql "SELECT \"CODE_QP\", \"NOM_QP\", \"COMMUNE_QP\", CASE WHEN NOT IsValid(geometry) THEN ST_MakeValid(geometry) ELSE geometry END AS geometry FROM \"QP_METROPOLEOUTREMER_WGS84_EPSG4326\"" | |
ogrinfo out.shp -dialect SQLite -sql "SELECT count(*) FROM out WHERE NOT IsValid(geometry)" |
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
import os | |
from osgeo import gdal | |
# gdal.UseExceptions() | |
# gdal.SetConfigOption('CPL_DEBUG', 'ON') | |
# Create a test CSV | |
file = "test.csv" | |
with open("test.csv", "w") as csv: | |
csv.write("latitude,longitude\n") |
Lancer le script bash ./get_mairies_from_ign_bdtopo.sh
Il permet de créer 2 fichiers GeoJSON:
mairies_multipolygons.geojson
est celui des emplacements de la mairie principale pour chaque commune. Quelques lignes sont vides, certaines communes n'ayant plus de mairie (exemple des communes mortes pour la France)centre_communes.geojson
prend le centre du polygone de la mairie et sinon le centre de la commune. En réalité, il ne s'agit pas d'un centre mais d'un opération qui génère un centroide et le corrige pour s'assurer que ce dernier est bien dans le multipolygone.
Nous créons un 3ème fichier centre_communes.csv
pour ceux qui préfèrent un fichier pla
Due to https://georezo.net/forum/viewtopic.php?pid=352701#p352701 (in French)
Considering an existing MySQL/MariaDB database you have created where you have access, run the SQL commands below
To create table
CREATE TABLE IF NOT EXISTS points_xy_no_geom_col (
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
node_modules/ |
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 -O api_result_datatourisme.json https://www.data.gouv.fr/api/1/datasets/5b598be088ee387c0c353714 | |
remote_url=$(cat api_result_datatourisme.json | jq '.resources | sort_by(.published) | reverse' | jq -r '.[].url' | grep naq | head -n1) | |
wget "$remote_url" | |
xsv search -d ',' \ | |
-s "Categories_de_POI" "https://www.datatourisme.gouv.fr/ontology/core#Library" \ | |
datatourisme-reg-naq-20220321.csv \ | |
| sed '1s/.*/\L&/' \ | |
| csvtojson \ | |
| jq -c .[] \ | |
| ndjson-map 'd2 = {"type": "Feature", "properties": d, "geometry": {"type": "Point", "coordinates": [Number(d.longitude), Number(d.latitude)]}}, d2' \ |