Calculate travel distance using Power Automate Microsoft Office 365 distance

Calculate travel distance using Power Automate

When you have an app that has a current location and a destination postcode and you want to calculate travel distances, you could use Power Automate.

Bing Maps

To use the Bing Maps connector you will first need to create a Bing Maps account.

Visit the Bing Maps Developer site then you will need to create an account. Once you have an account there is the option My account -> My Keys. And you can simply login with your Microsoft 365 account so this is all quite easy.

Calculate travel distance using Power Automate Microsoft Office 365 My Keys

This is where we can get our API key:

Calculate travel distance using Power Automate Microsoft Office 365 Create Key

Just supply the key details in the Create key pane and then the key will be made available

Calculate travel distance using Power Automate Microsoft Office 365 Key Generated

Just click on the Show key and copy the key.

Calculate travel distance in Power Automate

I’m creating a flow that has a Get route action in it.

Calculate travel distance using Power Automate Microsoft Office 365 Get Route Accepted the API Key

The above action might look slightly clumsy, but it is very good. the comment is suggesting that a longitude and latitude is need but you can actually use postcodes. The actions are even clever enough to identify which country the codes are for. Well, it worked for UK postscodes at least.

So in my example I’m taking two postcodes. The first postcode is in Windsor and the second postcode is 10 Downing Street.

Calculate travel distance using Power Automate Microsoft Office 365 Configure FLow for the ques to travel to 10 Downing Street

When we now run the flow we would get the distance in kilometres. So I changed this to miles as the UK uses miles for distance.

Calculate travel distance using Power Automate Microsoft Office 365 Miles and Driving

So if we now run our flow we will get the following output:

Calculate travel distance

We can see the distance between two postcodes. The normal travel duration and the current travel duration with the traffic taken into account.

So by using just one simple action you can calculate travel distances within Power Apps. It cannot get much easier than that.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: