Skip to content

Commit

Permalink
Update OSM API URL format
Browse files Browse the repository at this point in the history
  • Loading branch information
12v committed Sep 8, 2023
1 parent b888b23 commit 9a3fa0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sugartrail/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 9a3fa0b

Please sign in to comment.