Skip to main content

Notifications

Community site session details

Community site session details

Session Id : Zt7VX3/9RsCY4O9Zio4Wdu
Power Apps - Building Power Apps
Answered

Calculate distance

Like (0) ShareShare
ReportReport
Posted on 3 Mar 2017 11:06:21 by
  1. Hi

 

I just discover PowerApps and i want to know if it s possible to make an app for calculate distance between two adresses. i want my user can have a file where all professionnal car ride can be save per month for each month.

 

Example :

 

- User enter the date of path

- User type city 1 to city 2 API (if i can have some predictive adresse like Waze or other GPS apps it s better)

- API calculate kilometer for ride car between 2 points

- Then save the result into a file where title is username and month = User1August2017

- in this file i can have all the drive path of the august month and a formula can calculate with a ratio the fee to refund for my employee.

 

  • ItsBradMorgan Profile Picture
    7 on 18 May 2020 at 17:01:46
    Re: Calculate distance

    Is there a way to get the distance across countries? GetRoute seems to only work if it is drive-able, but we would like to get travel distance even if flying.

  • Community Power Platform Member Profile Picture
    on 05 Mar 2019 at 14:58:43
    Re: Calculate distance

    @CarlosFigueira @v-monli-msft 

     

    Distance1.jpg

    What about creating a gallery and having the miles populate for each row? So far, I see that I can press a button to calculate the miles. Could this feature become dynamic? 

  • CarlosFigueira Profile Picture
    on 15 Feb 2019 at 14:25:35
    Re: Calculate distance

    Not sure - the results come from Bing directly. Can you try looking at the "dist" variable (on the ribbon, select View -> Variables, then select it), especially the "routeLegs" property, to see if it the start/end points actually match the results. Sometimes it's possible that Bing will consider one of your start/end points a place other than the one that you want.

    InspectingVariable.gif

  • Community Power Platform Member Profile Picture
    on 13 Feb 2019 at 20:29:48
    Re: Calculate distance

    Thanks! @CarlosFigueira It seems to be working for most of the states I've tested except Delaware. For example,  from Middletown, DE to Camden, DE is about 30 miles, but PowerApps is displaying 305 miles instead. Any reason why this may be happening?

  • CarlosFigueira Profile Picture
    on 13 Feb 2019 at 13:45:11
    Re: Calculate distance

    You can request the unit to be returned in miles from the Bing Maps connector itself:

    Set(
     dist,
     BingMaps.GetRoute(
     "San Francisco, CA",
     "Los Angeles, CA",
     { distanceUnit: "Mile" }))

    You can find more details on the documentation for the Bing Maps connector.

  • Community Power Platform Member Profile Picture
    on 13 Feb 2019 at 13:24:12
    Re: Calculate distance

    @CarlosFigueira Hello! How do you converted the distance to display in Miles instead of KM?

  • JEastman12 Profile Picture
    4 on 04 Dec 2018 at 20:53:22
    Re: Calculate distance

    This is great, worked like a charm!

  • Verified answer
    CarlosFigueira Profile Picture
    on 06 Sep 2017 at 17:32:20
    Re: Calculate distance

    You can use the Bing Maps connector to calculate a distance between two cities:

    ForumPost001.PNG

    Once you have that connection added, you can use the GetRoute function to calculate the distance between two addresses. For example, in a button you can have the following formula on its OnSelect property:

    Set(dist, BingMaps.GetRoute("San Francisco, CA", "Los Angeles, CA"))

    And after clicking the button you can get the distance by accessing the properties in the dist variable, for example, in the Text property of a label:

    "Distance: " & dist.travelDistance & " " & dist.distanceUnit
  • Community Power Platform Member Profile Picture
    on 06 Sep 2017 at 09:16:06
    Re: Calculate distance

    Is there any news about this feature ?

     

    Thanks

  • Community Power Platform Member Profile Picture
    on 10 Mar 2017 at 07:45:08
    Re: Calculate distance

    yeah i don t see API plugin for calculate distance between two points like google map our other.

     

    I can do it with excel file, so for moment i try to do an App for just collect data per user into database

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 14

#2
LC-26081402-0 Profile Picture

LC-26081402-0 10

#3
stampcoin Profile Picture

stampcoin 6

Overall leaderboard