Logistics planning can be a complicated task. But what if there was a dashboard that showed you where your employees are and how far they are from the office? This could be very useful to calculate emissions per employee. In this blog, we will show you how to link Google Maps to your dashboard and automatically calculate the distance between the employee and the destination.
Dimmensions
First, we need to assign each worker to a city. This is done in the properties of Text 1.
Next, we go to UD1, where we enter the locations. These locations will be the workers' destination points. We again put the name of the city in Text 1.
Coding
After entering the cities, you need to create two Business Rules that retrieve the Google API and store them in a data table. Call the Business Rules "FXT_TravelDistance_FTD" and "MapPinPoint". The code can be found here.
Data adapters
After creating the Business Rules, you need to create two data adapters: one for the map and the other for the location. You can find the SQL query for da_GoogleData.
here.
BI Viewer
After creating the two data adapters, create a BI Viewer called biv_Map_PD. This BI Viewer will contain the two data adapters. Next, you need to design the BI Viewer. In our BI Viewer, we can set what distance we want to display between the destination and the employees. This is a calculated field.
Final result
Place the BI Viewer under a dashboard, and this should be your final result: