Geocoding is the process of converting a street address into latitude and longitude. This operation is critical to in-vehicle navigation systems and online driving direction websites. Python has two excellent geocoder libraries available named geocoder and geopy. Both take advantage of online geocoding services to allow you to geocode addresses programmatically. The geopy library even lets you reverse geocode to match a latitude and longitude to the nearest address:
- First, let's do a quick example with the geocoder library, which defaults to using Google Maps as its engine:
import geocoder
g = geocoder.google('1403 Washington Ave, New Orleans, LA 70130')
print(g.geojson)
# {'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [-90.08421849999999, 29.9287839]},
'bbox': {&apos...