forked from Olav63/outils_OSM
formattage avec Black
This commit is contained in:
parent
16ed9aa07b
commit
7cfe3d3327
@ -25,7 +25,7 @@ from osm_vc63 import errors
|
|||||||
from osm_vc63 import requetes
|
from osm_vc63 import requetes
|
||||||
from osm_vc63.utils import Utils
|
from osm_vc63.utils import Utils
|
||||||
|
|
||||||
overpass_url="http://overpass-api.de/api/interpreter"
|
overpass_url = "http://overpass-api.de/api/interpreter"
|
||||||
geo_api_url = "https://api-adresse.data.gouv.fr"
|
geo_api_url = "https://api-adresse.data.gouv.fr"
|
||||||
dossier_sauvegarde = "resultats/"
|
dossier_sauvegarde = "resultats/"
|
||||||
|
|
||||||
@ -42,8 +42,7 @@ retry_delay = 120
|
|||||||
# id Romagnat : 138269
|
# id Romagnat : 138269
|
||||||
|
|
||||||
# l'id de l'area se calcule en ajoutant 3600000000 au numéro de l'objet OSM
|
# l'id de l'area se calcule en ajoutant 3600000000 au numéro de l'objet OSM
|
||||||
aire_de_recherche = str(3600000000+110866)
|
aire_de_recherche = str(3600000000 + 110866)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
@ -67,22 +66,20 @@ trad_bicycle_parking = {
|
|||||||
"rope": "Câble",
|
"rope": "Câble",
|
||||||
"two-tier": "Deux étages",
|
"two-tier": "Deux étages",
|
||||||
"floor": "Sol",
|
"floor": "Sol",
|
||||||
"handlebar_holder": "Accroche-guidons"}
|
"handlebar_holder": "Accroche-guidons",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def executer_requete_et_exporter_resultats(
|
||||||
|
nom_req, critere, aire_de_recherche, overpass_query_fields
|
||||||
|
):
|
||||||
|
|
||||||
|
|
||||||
def executer_requete_et_exporter_resultats(nom_req, critere, aire_de_recherche, overpass_query_fields) :
|
|
||||||
|
|
||||||
utils = Utils(overpass_url, geo_api_url, dossier_sauvegarde)
|
utils = Utils(overpass_url, geo_api_url, dossier_sauvegarde)
|
||||||
data = utils.run_overpass_query(critere, aire_de_recherche)
|
data = utils.run_overpass_query(critere, aire_de_recherche)
|
||||||
|
|
||||||
nb_elements = len(data["elements"])
|
nb_elements = len(data["elements"])
|
||||||
|
|
||||||
print("Nombre d'elements : "+str(nb_elements))
|
print("Nombre d'elements : " + str(nb_elements))
|
||||||
"""
|
"""
|
||||||
print("Géocodage inversé : ", end="", flush=True)
|
print("Géocodage inversé : ", end="", flush=True)
|
||||||
|
|
||||||
@ -135,17 +132,16 @@ def executer_requete_et_exporter_resultats(nom_req, critere, aire_de_recherche,
|
|||||||
export_json = utils.nettoyage_json_pour_umap(data, overpass_query_fields)
|
export_json = utils.nettoyage_json_pour_umap(data, overpass_query_fields)
|
||||||
|
|
||||||
# Sauvegarde
|
# Sauvegarde
|
||||||
os.makedirs(dossier_sauvegarde, exist_ok = True)
|
os.makedirs(dossier_sauvegarde, exist_ok=True)
|
||||||
|
|
||||||
utils.as_json(export_json, nom_req)
|
utils.as_json(export_json, nom_req)
|
||||||
utils.as_ods(overpass_query_fields, data, nom_req)
|
utils.as_ods(overpass_query_fields, data, nom_req)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
for req in requetes.reqs:
|
for req in requetes.reqs:
|
||||||
|
|
||||||
for nb_essai in range(max_retry): # on tente max_retry fois
|
for nb_essai in range(max_retry): # on tente max_retry fois
|
||||||
try:
|
try:
|
||||||
executer_requete_et_exporter_resultats(
|
executer_requete_et_exporter_resultats(
|
||||||
req.nom, req.critere, aire_de_recherche, req.champs
|
req.nom, req.critere, aire_de_recherche, req.champs
|
||||||
@ -167,4 +163,3 @@ def main():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user