27 lines
1.3 KiB
Bash
27 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"];
|
|
way(area)["bridge"]["name"];
|
|
out geom;
|
|
area(-60.0,-20.0,10.0,52.0)["ISO3166-1"="FR"]["admin_level"="4"];
|
|
way(area)["bridge"]["name"];
|
|
out geom;'
|
|
|
|
# Définir le nom du fichier de sortie
|
|
OUTPUT_FILE="bridges_in_france.json"
|
|
OUTPUT_FILE_GEO="bridges_in_france.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éé."
|
|
geojson2osm "$OUTPUT_FILE" "$OUTPUT_FILE_GEO" -f
|
|
date2name "$OUTPUT_FILE_GEO" "$OUTPUT_FILE_GEO"
|
|
else
|
|
echo "Erreur lors de l'export : $?"
|
|
fi
|