This component adds static Google Maps to SAP Predictive Analysis. The user can chose through parameters what locations should be displayed, their color coding, the map’s zoom level and the region the map should focus on.
Please scroll to the bottom of this page for instructions on implementing this function (R Code and Configuration). In the next chapter you will also find a sample dataset. The file contains a small part of a perception survey done by Eurostat in 2009 about the quality of life in 75 different European cities. The cities were clustered with this component and later enriched with geocoordinates. Even though the clustering did not know anything about the location of the cities, it is striking how the clusters are clearly visible on the geographical map.
Thank you very much to our R-Expert Pramila (Pramilamma Bovilla) for adding the setInternet2() function and the destfile parameter to make this script work in SAP Predictive Analysis!
If you are new to creating Custom R Components in SAP Predictive Analysis, you can have a look at this overview to get you started. Please note that this code is not supported by SAP. When using this function please carry out your own testing.
Load the dataset EuropeanUrbanAudit_WithClusterAndGeocodes.csv into SAP Predictive Analysis.
Next add the new “Google Maps” component to your model.
Configure the component. You need to set the following:
- The geographic region for the map to center on.
- Zoom Level.
- A numerical column that controls the color coding (for instance a cluster number).
- Whether the places should be displayed by dots or with their names.
- The column that holds the place names (only used if the places are to be displayed by name).
- Columns holding the latitude and longitude coordinates.
Run the model and click on ‘Charts’. You can see how the clusters, that were created without any knowledge about their geographic location, are very much located together on the map! The perception of quality of life clearly has a strong relationship to the location.
If you want to know more the structure of these clusters, you can look at them in the Hierarchical Clustering component.
How to Implement
The component can be downloaded as .spar file from GitHub. Then deploy it as described here. You just need to import it through the option “Import/Model Component”, which you will find by clicking on the plus-sign at the bottom of the list of the available algorithms.