cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NickK
Helper I
Helper I

Use Phone GPS to find closest store

Hello, 

 

I've built an app to give colleages in the field easy access to retail store level data (sales, lease & design info). 

 

They are asking for me to add the ability for the app to find the nearest store to them instead of searching for a store. 

 

I know I can use the phone's gps location and all my records have latitude and longitude coordinates (in decimal degrees) as well. 

 

Has anyone attempted this?

 

I've found several examples of the math required to get the distance between 2 sets of Lat&Long values, but they require setting variables for a distance calculation. (Something I haven't done). 

 

Any help will be appreciated, Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
claudiosvcc
Power Apps
Power Apps

Hi,

I think of three ways you can solve your issue:

1 - If you have the function, you can create hidden text labels as intermediate values; You can do some math by just pointing the Label name (e.g., Label1/2 will get Label1 value and divide by 2)

or

2 - You can try using Context variables (e.g., UpdateContext({val1:Location.Latitude});UpdateContext({var:Atan(val1/2)}) for a dumb example);

3 - You can create a customapi that can connect to some api (such as Bing maps) and makes the math directly. This option needs more work to build, but it's better since it will get you the actual driving distance between two points and might eventually give you the traffic, etc.

 

There might be better solutions, though.

View solution in original post

1 REPLY 1
claudiosvcc
Power Apps
Power Apps

Hi,

I think of three ways you can solve your issue:

1 - If you have the function, you can create hidden text labels as intermediate values; You can do some math by just pointing the Label name (e.g., Label1/2 will get Label1 value and divide by 2)

or

2 - You can try using Context variables (e.g., UpdateContext({val1:Location.Latitude});UpdateContext({var:Atan(val1/2)}) for a dumb example);

3 - You can create a customapi that can connect to some api (such as Bing maps) and makes the math directly. This option needs more work to build, but it's better since it will get you the actual driving distance between two points and might eventually give you the traffic, etc.

 

There might be better solutions, though.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,491)