28 lines
1.3 KiB
Bash
28 lines
1.3 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Définir la requête Overpass
|
||
|
OVERPASS_QUERY='[out:json][timeout:200];
|
||
|
area["ISO3166-1"="FR"]["admin_level"="2"];
|
||
|
nwr(area)["maxspeed"];
|
||
|
out geom;
|
||
|
area(-60.0,-20.0,10.0,52.0)["ISO3166-1"="FR"]["admin_level"="4"];
|
||
|
nwr(area)["maxspeed"];
|
||
|
out geom;'
|
||
|
|
||
|
# Définir le nom du fichier de sortie
|
||
|
OUTPUT_FILE="routes_maxspeed.json"
|
||
|
OUTPUT_FILE_GEOJSON="routes_maxspeed.geojson"
|
||
|
|
||
|
# Exécuter la requête Overpass avec Overpass Turbo
|
||
|
curl -H 'Accept-Encoding: identity' 'https://overpass-api.de/api/interpreter' -X POST -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0' -H 'Accept: */*' -H 'Accept-Language: fr,en-US;q=0.7,en;q=0.3' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Origin: https://overpass-turbo.eu' -H 'Connection: keep-alive' -H 'Referer: https://overpass-turbo.eu/' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Sec-GPC: 1' -H 'Priority: u=1' --data-raw "data=${OVERPASS_QUERY}" -o "$OUTPUT_FILE"
|
||
|
|
||
|
# Vérifier si la requête a réussi
|
||
|
if [ $? -eq 0 ]; then
|
||
|
echo "Export réussi! Le fichier $OUTPUT_FILE a été créé."
|
||
|
else
|
||
|
echo "Erreur lors de l'export : $?"
|
||
|
fi
|
||
|
|
||
|
osm2geojson $OUTPUT_FILE $OUTPUT_FILE_GEOJSON -f
|
||
|
date2name $OUTPUT_FILE $OUTPUT_FILE_GEOJSON
|