Geocoding
Last modified by Jan Rhebergen on 2022/01/24 15:56
Geocoding is the process of turning text into coordinates. For more information look at the wikipedia page: https://en.wikipedia.org/wiki/Address_geocoding
There are several online services available to perform this task with. To make it easy there is a user agent available as a python library:
Example snippets on how to incorporate geopy geocoding into your scripts/apps:
def geocode(place):
"""
Use geopy with Nominatim as geocoding service
"""
# get a handler for a Nominatim service object
service = geopy.Nominatim(user_agent = "myGeocoder")
if (placeObj:= service.geocode({'city':f"{place}"},country_codes="NL,BE,LU")):
coords = list(placeObj)[-1]
else:
coords = (0,0)
return coords