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.
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.
- The data must contain a column with the destinations of the travelling route.
- You must be online to use this component.
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.
These parameters can be set by the user.
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
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.
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.