Custom R Component – Travelling Time and Distance
This component determines the travelling time and distance between a specific place and multiple locations held in a data column. A customer was asking for this functionality to help optimising its logistics / supply chain.
Disclaimer
Please note that this component is not an official release by SAP and that it is provided as-is without any guarantee or support. Please test the component to ensure it works for your purposes.
Prerequisites
- The data must contain a column with the destinations of the travelling route.
- You must be online to use this component.
Limitations
The travelling time and distance is calculated through Google Maps. There are limitations on the number of requests you can sent in a given time frame.
Usage
These parameters can be set by the user.
Parameter | Description |
---|---|
Origin Address |
Location from where to calculate travelling time and distance. |
Mode of Transport | You can select Driving, Bicycling or Walking. In case no route could be calculated, no value is returned for the distance. |
Destination Address | Column that holds the destination addresses. |
Output column added by this component
Column | Description |
---|---|
Origin |
The “Origin Address” as entered by the user. |
DistanceKm | The travelling distance in kilometers. |
DistanceMin | The travelling time in minutes. |
TransportMode | The “Mode of Transport” as entered by the user. |
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.
Example
You can try this component with the file Cities.csv. The records are taken from the article on Hierarchical Clustering. Just load the data in Expert Mode and add/configure this component accordingly.
Run the component and you should see the travelling time and distance.