This file contains hidden or 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 hidden or 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 hidden or 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' \ |
This file contains hidden or 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
Show hidden characters
{ | |
"env": { | |
"node": true, | |
"es2021": true | |
}, | |
"extends": "eslint:recommended", | |
"parserOptions": { | |
"ecmaVersion": "latest", | |
"sourceType": "module" | |
}, |
This file contains hidden or 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 hidden or 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
declare -a depts=(01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 2A 2B 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 971 972 973 974 976) | |
true >| stats_api_pro_bio.txt | |
for i in "${depts[@]}" | |
do | |
url="https://back.agencebio.org/api/gouv/operateurs/?departements=$i"; | |
tot=$(curl -X 'GET' "$url" -H 'accept: application/json' | jq -r '.nbTotal'); | |
echo "${i};${tot}" >> stats_api_pro_bio.txt; | |
done |
Source: fichier "Base des accidents corporels géocodée" sur la page https://www.data.gouv.fr/fr/datasets/bases-de-donnees-annuelles-des-accidents-corporels-de-la-circulation-routiere-annees-de-2005-a-2020/
Commande utilisée
ogr2ogr -f CSV accidents-motos-2005-2006.csv accidents.csv -dialect SQLite -sql "SELECT * FROM accidents WHERE \"ANNEE\" IN (2005, 2006) AND \"has_deuxrouesmotorises\" = 'true'"