2024-10-17 12:25:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# export depuis OSM des points
|
|
|
|
# "harassment_prevention=ask_angela"
|
|
|
|
# pour le monde entier
|
|
|
|
|
2024-10-18 12:27:27 +02:00
|
|
|
|
2024-10-17 13:14:08 +02:00
|
|
|
|
2024-10-18 11:10:19 +02:00
|
|
|
url='https://overpass-api.de/api/interpreter?data=[out:json][timeout:25];nwr["harassment_prevention"="ask_angela"];out+meta;'
|
2024-10-17 13:40:46 +02:00
|
|
|
|
2024-10-17 13:14:08 +02:00
|
|
|
export_file="ask_angela_points_from_openstreetmap"
|
2024-10-17 12:25:25 +02:00
|
|
|
|
2024-10-18 12:27:27 +02:00
|
|
|
echo -e "\n récupération de données depuis OpenStreetMap \n"
|
|
|
|
echo " export osm de: $export_file"
|
2024-10-17 12:25:25 +02:00
|
|
|
# Télécharger le fichier GeoJSON
|
2024-10-18 11:10:19 +02:00
|
|
|
curl -X GET -o "$export_file.json" -g $url
|
2024-10-17 13:40:46 +02:00
|
|
|
|
2024-10-18 12:27:27 +02:00
|
|
|
echo -e "\n Curl OK \n"
|
2024-10-17 12:25:25 +02:00
|
|
|
date
|
2024-10-18 12:27:27 +02:00
|
|
|
echo -e "nombre de points extraits depuis overpass turbo :"
|
|
|
|
jq '.elements | length' "$export_file.json"
|
2024-10-18 11:10:19 +02:00
|
|
|
|
2024-10-18 12:27:27 +02:00
|
|
|
# on garde la version OSM brute des données extraites
|
|
|
|
cp "$export_file.json" "../../osm_output/$export_file.osm.json"
|
2024-10-18 11:10:19 +02:00
|
|
|
|
2024-10-18 12:27:27 +02:00
|
|
|
# on convertir en geojson
|
|
|
|
osm2geojson -q -i 2 --reader json "$export_file.json" "$export_file.geojson" -f
|
2024-10-18 11:10:19 +02:00
|
|
|
echo -e "\n -> fichier converti: $export_file.geojson "
|
|
|
|
|
2024-10-18 12:27:27 +02:00
|
|
|
# on déplace dans le dossier osm_output les versions brutes et converties
|
2024-10-17 13:31:35 +02:00
|
|
|
mv "$export_file.geojson" "../../osm_output/$export_file.geojson"
|
2024-10-18 11:10:19 +02:00
|
|
|
echo " -> fichier placé dans ../../osm_output/$export_file.geojson "
|
|
|
|
|
2024-10-18 12:27:27 +02:00
|
|
|
# on convertit le geojson en csv
|
2024-10-17 13:14:08 +02:00
|
|
|
python3 geojson_to_csv.py "../../osm_output/$export_file.geojson" -o "../../osm_output/$export_file.csv"
|
2024-10-18 11:10:19 +02:00
|
|
|
|
2024-10-18 15:36:34 +02:00
|
|
|
rm "$export_file.json"
|
2024-10-18 12:27:27 +02:00
|
|
|
echo "nombre de features dans l'export geojson :"
|
|
|
|
jq '.features | length' "../../osm_output/$export_file.geojson"
|