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
Calculate travel distance using Power Automate 1

This is where we can get our API key:

Calculate travel distance using Power Automate
Calculate travel distance using Power Automate 2

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

Calculate travel distance using Power Automate
Calculate travel distance using Power Automate 3

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
Calculate travel distance using Power Automate 4

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
Calculate travel distance using Power Automate 5

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
Calculate travel distance using Power Automate 6

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

Calculate travel distance
Calculate travel distance using Power Automate 7

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.


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Related Posts

Leave a Reply

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

Discover more from SharePains

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

Continue reading