Enriching Geographical Data Using the OpenCage Geocoder API
Users often store geographical data on a record in their database. This record may pertain to the location of given customer, the coordinates of a delivery route, etc. This geographical data is most often stored in either latitude-longitude coordinates or plain language address data. Often, users only find it necessary to store one format or the other.
Using the requests library within a Python notebook, we can use a Geocoder API to either Reverse or Forward encode the geographical data stored in our database. Examples of this would be:
- Reverse Encode: Convert latitude-longitude data to address data
- Forward Encode: Convert address data to latitude-longitude data
In this example, we make a request to the Opencage Geocoder API in order to reverse encode the latitude-longitude data stored in our database to obtain the corresponding address data for each record. By doing this, we create an enriched dataset, providing us more human-readable fields to segment on, filter, and analyze.