cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MH3
Post Prodigy
Post Prodigy

Storing GPS Location(Latitude and Longitude) - Google Maps or Bing Maps

Hi Everyone,

 

I have an Attendance application which uses SP List as it's DataSource, the app is working fine, but the client need to get the location of the users who are checking in, Daily.

 

by using Bing maps or Google Maps, I have searched all the internet and the community but couldn't found anything which would be helpful for my application.

 

Example: Functionality

It's an application which I had seen on  Youtube, I want something like this, that when user Checks he/she should be able to see the map when checking in and in the SP List, it should Store Longitude, Latitude.
map.png

After Checking In, The user should see this screen, in which the longitude and latitude should be converted into an address for the user to understand and it should also save into SharePoint List Like City, Street and Address.

Successfull.png


I need help in this requirement, I am kinda stuck couldn't find anything helpful.

 

Thanks

9 REPLIES 9
WarrenBelz
Super User
Super User

HI @MH3 ,

PowerApps has built-in functions Location.Latitude and Location.Longitude that you can use to identify and store this. For the map, 

Launch("https://www.google.com/maps/search/?api=1&query=" & ThisItem.Lat & "," & ThisItem.Long)

will do the job assuming you name the fields Lat and Long.

 

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.

Hi @WarrenBelz ,

 

Yes, The internet was slow, I thought the question was not posted, So, I posted it again, Sorry. I will remove that post.

 

By using your approach, I added Location Latitude and Longitude, when OnSelect of the button, but the Data is not patching in SP List.

 

My Code:

  Patch(
       Attendance,    /*my SP List*/
        Defaults(Attendance),
        {
          Title: "Check In&Out Test",
          User: MyUser,
          'User Email': User().Email,
           WorkDate:Text(Now(),"[$-en-US]yyyy-mm-dd"),
          Check_x0020_In: Now(),
          Lat:Location.Latitude,
          Long:Location.Longitude,
          Status: "IN"
        }
    ); 
Navigate(CheckInSuccess,ScreenTransition.Cover)


My SP List:

Cols.jpg

Entry.jpg

Here you can see the last two entries, dont have longitude and latitude data, why it's happening like that?

Help

Hi @MH3 ,

Firstly, try this

UpdateContext(
   {
      vLat:Location.Latitude
      vLong:Location.Longitude
   }
);
Patch(
   Attendance,    /*my SP List*/
   Defaults(Attendance),
   {
      Title: "Check In&Out Test",
      User: MyUser,
      'User Email': User().Email,
      WorkDate:Text(Now(),"[$-en-US]yyyy-mm-dd"),
      Check_x0020_In: Now(),
      Lat:vLat,
      Long:vLong,
      Status: "IN"
   }
)

If this does not work, have a look at vLat and vLong (View > Variables) and see if there are values in there. If not it is because location services are not set on the PC you are using. I can guarantee you this works as I have about 120 staff in the field using this on thousands of entries. Maybe you need to test on a mobile device.

 

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.

Hi @WarrenBelz ,

 

Still no Success, This Time I checked in by using a Mobile Device, and still no Lat and Long data is patched into SP List.

 

and I have checked the Variables, they are showing No Value.

 

Any Help?

v-bofeng-msft
Community Support
Community Support

Hi @MH3 :

Are you currently stuck on "Unable to get location information"

I suggest you perform the following two operations:

  • Please check whether PowerApps has permission to access the location.

0707_1_LI.jpg

  • Replace a device and check if the problem persists

Best Regards,

Bof

Hi @v-bofeng-msft ,

 

I have allowed PowerApps to access the Location, but not only my device other employees who are using the application when they check in their location is not patching into the SP List.

 

I have used this code for Check in:

UpdateContext(
   {
      vLat:Location.Latitude,
      vLong:Location.Longitude
   }
);
Patch(
   Attendance,    /*my SP List*/
   Defaults(Attendance),
   {
      Title: "Check In&Out Test",
      User: MyUser,
      'User Email': User().Email,
      WorkDate:Text(Now(),"[$-en-US]yyyy-mm-dd"),
      Check_x0020_In: Now(),
      Lat:vLat,
      Long:vLong,
      Status: "IN"
   }
);

Navigate(CheckInSuccess,ScreenTransition.Cover)


Also can you help me try to build that location feature, just like in the ScreenShots which I have shared in my Question.

 

Thanks!

Hi @WarrenBelz ,

 

I had checked the variables again, they are still showing no value

locatio.jpg
Although powerapps has access to the location as well.

 

Any Help Thanks

Hi @MH3 ,

This had got to be something in the settings of your PC that is not passing on the coordinates.

Put two labels on your screen with Location.Latitude and Location.Longitude - I just did on the PC is am using now and got the coordinates of where I am.

 

 

Hi @WarrenBelz ,

 

Today and Yesterday, I checked in through my phone, but it still not saving any coordinates, although the location is allowed for powerapps as well.


PC ScreenShotPC ScreenShot




Mobile ScreenShotMobile ScreenShot

However it shows the location on label, but its not patching it into the list.

What's the problem?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,212)