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 / How to get a range of ...
Power Apps
Answered

How to get a range of latitude and longitude for covering a whole area

(0) ShareShare
ReportReport
Posted on by 422

Hello All,

 

I made a power app which gets user location (Lat,long) on button click. Now i have a new requirement i don't want user to use App when they are in office. 

so i thought of putting an IF clause which will work on a range of Lat long and when Lat long range will fall under the office range Lat Long ,it will give error.

I am not sure if it will be possible that way , Please advise if anyone have a better solution or idea how to achieve this they way i am thinking.

that's how i am getting lat long on a filed 

 UpdateContext({LocVarAS:Location.Latitude & "," & Location.Longitude});

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,373 Most Valuable Professional on at

    Hi @SachinG31 ,

    Simplistically, pick a distance from both Latitude and Longitude that they cannot exceed. I have a much more complicated formula for exact distance (although this is still a radius circle), but at the equator, one degree is 111 kilometres, meaning 0.0001 of a degree is 11.1 metres (round it to 10 metres for this purpose) so if you had the Lat/Long of your office as LocVarOL, and you did not want them to exceed 50 metres

    If(
     Abs(LocVarAS.Latitude - LocVarOL.Latitude) > 0.0005 ||
     Abs(LocVarAS.Langitude - LocVarOL.Longitude) > 0.0005,
     YourStopCodeHere, // more than 50 metres away
     YourRunCodeHere
    )

     

    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

  • SachinG31 Profile Picture
    422 on at

    hello @WarrenBelz , Thank you so much for the solution and detailed explanation. i will implement this and het back to you with result.

    Thanks again 

  • SachinG31 Profile Picture
    422 on at

    Hello @WarrenBelz , Sorry for the late revert and Thank you so much for providing solution. it is working good as per my requirment.

    I really appricate your time and efforts you took to explain this solution in detail. 

    Good day !!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard