Geocoding addresses with Google API
In Celonis IBC you have the Worldmap available as standard component. When you want to use this component you can choose to use the ISO country codes or the latitude and longitude coordinates. The country codes should already be available in the source application. For a more detailed view it is better to use the latitude and longitude coordinates.
But what if you do not have the geocodes available in the source system? In that case you can use the Geocoding API from Google. As input you can use the address as it is stored in the source application and call the API with these addresses. The Geocoding API will return the geocode per address.
First we define a view in Celonis for the source addresses. This view contains 2 columns: the first column contains the ID of the address, in our case this is the location_id. The second column contains the concatenated address.
We define a second view to be able to link the addresses view to the cases table. Our cases table is the table with all the AR invoices and this table does not contain the location_id, so we define a second view that links the ID from the invoice with the ID from the address. We add both views to the datamodel in Celonis.
Once the datamodel is loaded we can define a simple OLAP table in Celonis that is showing the addresses. We can access the data from this OLAP table in the Machine Learning workbench.
In the Celonis Machine Learning workbench we access the addresses from the OLAP table and call the Google Geocoding API. The Geocoding API provides us with the geocode for almost all addresses. The result is pushed to the datamodel and can be used in the analysis in Celonis. In the Worldmap component we can now use the latitude and longitude coordinates as dimension:
We can define the KPI we want to use in the Worldmap, e.g. the “number of invoices”. We give the datapoint a meaningful name, e.g. “Customer”. This will give us an interactive world map with the number of invoices by geocode:
For more information about geocoding with the Google API please visit: https://developers.google.com/maps/documentation/geocoding/start