web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to calculate dista...
Power Apps
Answered

How to calculate distance using the google map API?

(0) ShareShare
ReportReport
Posted on by 28

TESTTEST

 

 

 

 

 

 

 

BingMaps.GetRoute("35.05321,-93.367623", "Space Needle, Seattle",{distanceUnit:"Kilometer",optimize:"distance"}).travelDistance & "KM"  = Bing Map calculate distance 

But I want to know the formula of Google Map to calculate the distance in PowerApps.

 

Categories:
I have the same question (0)
  • v-xiaochen-msft Profile Picture
    on at

    Hi @Littlecatt ,

     

    Could you tell me:

    What specific distance do you want to obtain? Where is the starting point? Where is the end point?

     

    Best Regards,

    Wearsky

  • Littlecatt Profile Picture
    28 on at

    Start = USA   38.609893, -90.193981 
    END = Thailand   13.748629, 100.514354 

    Best Regards,
    Littlecatt

  • Verified answer
    WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    Hi @Littlecatt ,

    To add to this, I am not sure what you mean exactly, but using simply Latitude and Longitude of the current location and that of the Item selected, this works it out (although it is in a straight line).

    With(
     {
     wKlms: 
     12742 * Asin(Sqrt(0.5 - 
     Cos((ThisItem.Latitude - Location.Latitude) * 0.0174532925199432)/2 + 
     Cos(ThisItem.Latitude * 0.0174532925199432) * 
     Cos(ThisItem.Latitude * 0.0174532925199432) * 
     (1 - Cos((ThisItem.Longitude - Location.Longitude) * 0.0174532925199432)) / 2))
     },
     If(
     wKlms > 1,
     Round(
     wKlms,
     1
     ) & " K",
     Round(wKlms * 1000,0) & " M"
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Littlecatt Profile Picture
    28 on at

    Thank you 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard