mirror of
https://github.com/bellingcat/sugartrail.git
synced 2026-06-08 03:28:31 +03:00
Update OSM API URL format
This commit is contained in:
@@ -70,8 +70,8 @@ def get_nearby_postcode(postcode_string):
|
||||
|
||||
def get_coords_from_address(address_string):
|
||||
"""Attempt retrieval of coords for input address string."""
|
||||
address = urllib.parse.quote(address_string)
|
||||
url = 'https://nominatim.openstreetmap.org/search/' + urllib.parse.quote(address) +'?format=json'
|
||||
params = {'q': address_string, 'format': 'json'}
|
||||
url = 'https://nominatim.openstreetmap.org/search?' + urllib.parse.urlencode(params)
|
||||
response = requests.get(url).json()
|
||||
if response:
|
||||
return {'lat': response[0]['lat'], 'lon': response[0]['lon'], 'address': address_string}
|
||||
|
||||
Reference in New Issue
Block a user