Hide last authors
Jan Rhebergen 1.1 1 Geocoding is the process of turning text into coordinates. For more information look at the wikipedia page: [[https:~~/~~/en.wikipedia.org/wiki/Address_geocoding>>https://en.wikipedia.org/wiki/Address_geocoding]]
2
3
4 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:
5
6 * [[GeoPy>>https://geopy.readthedocs.io/en/stable/]]
7
8
9 Example snippets on how to incorporate geopy geocoding into your scripts/apps:
10
11 (% class="box" %)
12 (((
13 def geocode(place):
14 """
15 Use geopy with Nominatim as geocoding service
16 """
17 # get a handler for a Nominatim service object
18 service = geopy.Nominatim(user_agent = "myGeocoder")
19 if (placeObj:= service.geocode({'city':f"{place}"},country_codes="NL,BE,LU")):
20 coords = list(placeObj)[-1]
21 else:
22 coords = (0,0)
23 return coords
24 )))

Need help?

If you need help with XWiki you can contact: