Calculate travel distance using Power Automate Microsoft Office 365 distance

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.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

Leave a Reply

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

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading