forked from Olav63/outils_OSM
déplacement de logique dans la méthode de requêtage overpass
This commit is contained in:
parent
f97ffdb6d9
commit
27aea631bf
@ -147,10 +147,19 @@ def nettoyage_json_pour_umap(data, overpass_query_fields):
|
||||
return export_json
|
||||
|
||||
|
||||
def run_overpass_query(query) :
|
||||
def run_overpass_query(critere, aire_de_recherche) :
|
||||
"""Envoie la requête Overpass et retourne la réponse JSON."""
|
||||
|
||||
response = requests.get(overpass_url, params={'data': query})
|
||||
overpass_query = """[out:json];
|
||||
(
|
||||
"""+critere+"""
|
||||
);
|
||||
out center;
|
||||
"""
|
||||
overpass_query = overpass_query.replace("aire_de_recherche", aire_de_recherche)
|
||||
|
||||
print("Execution requete overpass : \n" + overpass_query)
|
||||
response = requests.get(overpass_url, params={'data': overpass_query})
|
||||
|
||||
if (response.status_code != 200) :
|
||||
raise errors.Overpass_error(response.status_code)
|
||||
@ -173,21 +182,7 @@ def run_reverse_geocoding(lat, lon) :
|
||||
|
||||
def executer_requete_et_exporter_resultats(nom_req, critere, aire_de_recherche, overpass_query_fields) :
|
||||
|
||||
print ("Nom requête : "+nom_req)
|
||||
|
||||
overpass_query = """[out:json];
|
||||
(
|
||||
"""+critere+"""
|
||||
);
|
||||
out center;
|
||||
"""
|
||||
|
||||
overpass_query = overpass_query.replace("aire_de_recherche", aire_de_recherche)
|
||||
|
||||
|
||||
print("Execution requete overpass : \n"+overpass_query)
|
||||
|
||||
data = run_overpass_query(overpass_query)
|
||||
data = run_overpass_query(critere, aire_de_recherche)
|
||||
|
||||
nb_elements = len(data["elements"])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user