Skip to content
Snippets Groups Projects
Commit d862d419 authored by Alexandre Pradeilles's avatar Alexandre Pradeilles
Browse files

fonction de requete

parent 3c6e39cc
No related branches found
No related tags found
No related merge requests found
{
"python.pythonPath": "C:\\Anaconda\\python.exe"
}
\ No newline at end of file
......@@ -6,18 +6,32 @@ def geocode(city):
g = geocoder.osm(city)
return (g.y,g.x)
def requete_osm(lat, lon):
params = {
'lat':lat,
'lon':lon,
'format':'json',
'zoom': 17,
'polygon_geojson' : 1
}
req = requests.get("https://nominatim.openstreetmap.org/reverse",params)
reqJson = req.json()
return reqJson
# Driver function
if __name__=="__main__":
# coordinates =[49.15,2.325]
# intersection : 48.711889 2.161818
# intersection : 48.711889 2.161818 48.895251, 2.247097 48.895038, 2.247522
#g = geocoder.osm([48.89, 2.247], method='reverse')
params = {
'lat':48.711889,
'lon':2.161814,
'lat':48.895038,
'lon':2.247522,
'format':'json',
'zoom': 17,
'polygon_geojson' : 1
}
req = requests.get("https://nominatim.openstreetmap.org/reverse",params)
reqJson = req.json()
print(reqJson)
\ No newline at end of file
print(reqJson['geojson']['coordinates'])
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment