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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Track location of user
Power Apps
Answered

Track location of user

(0) ShareShare
ReportReport
Posted on by 72

Hi, I have a button which signs in the user with the location. I want that button to be visible when that user is within 500 m of a radius if the user is outside of that radius then the button should be disabled.

Also, I have a label which shows the distance between the user and the point.

I am having problem with the live tracking of that user, while the user is walking that distance should be changed.

Also, I am not able to live track that user.

Categories:
  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @MrShivam ,

    This will get you the distance in metres from a given Lat/long

    With(
     {
     wLat1: YourLocation.Latitude,
     wLat2: Location.Latitude,
     wLong1: YourLocation.Longitude,
     wLong2: Location.Longitude,
     wCalc: 17.4532925199432
     },
     12742 * Asin(Sqrt(0.5 - Cos((wLat1 - wLat2) * wCalc)/2 + Cos(wLat1 * wCalc) * Cos(wLat2 * wCalc) * (1 - Cos((wLong1 - wLong2) * wCalc)) / 2))
    )

    So you just need to multiply this by 500 and disable the button accordingly. They can track themselves (their location is on their device) but you cannot track them unless you have a timer writing their distance back to the data source at set intervals.

     

    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.

    Visit my blog Practical Power Apps

  • MrShivam Profile Picture
    72 on at

    @WarrenBelz not getting correct distance. Getting correct distance with this formula but not able to track the userGetting correct distance with this formula but not able to track the userNot getting correct dataNot getting correct data

     

  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    @MrShivam ,

    For the collection - the structure is correct as is the formula and technically it should work.

     

    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.

    Visit my blog Practical Power Apps

  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @MrShivam ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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.

    Visit my blog Practical Power Apps

  • MrShivam Profile Picture
    72 on at

    Thanks, @WarrenBelz did not get the desired result. I want to track users inside a particular radius, location should dynamically change on every step of the user.

  • Verified answer
    WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    @MrShivam ,

    I provided a solution for your first question, which will be useful for others as that formula is not widely-distributed.

    For the second, it all depends how often you run the timer (which I suggested) - you will have 3,600 record per hour for each user if you run it every second and it would be highly usage and bandwidth intensive. Records written back are the only way you can "interact" with their current position. How are you expecting (if otherwise) to track the user?

     

    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.

    Visit my blog Practical Power Apps

  • MrShivam Profile Picture
    72 on at
  • MrShivam Profile Picture
    72 on at

    @WarrenBelz I am doing the same thing, on timer end i am collecting latitute and longitude, and passing that value into formula but distance is not changing 

  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    @MrShivam ,

    I can only answer within the capabilities of Power Apps - the purpose of this forum is to provide future users with solutions to problems.

    Your first question has been answered (which is useful for others) and the fact that there is no solution to the second is actually a solution in itself as it will stop them expending additional effort looking for one.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard