Location validation

Hey Team,

I’m trying to include a location validation in my Glide app.
Steps would be:

  • Employee is at the location of client
  • Validation between client’s location in system and employee’s location
  • If employee is at the client’s location, he’s able to start a shift

Is there any way to do this using Glide?

You can use the Distance column to calculate the Distance between a user’s current location and a fixed address. The user’s current location needs to be captured manually at a point in time (Glide can’t “follow” someone without them interacting with the Location component).

Once you know the Distance, you can control the visibility of a form button, for example, and only show the button when the Distance is less than a certain amount (like 1 mile, for example).

Yes I got there after a bit more research :slight_smile:

For anyone interested, there’s a great video here: Calculate distance in Microsoft Excel using latitudes and longitudes. - YouTube

I’d recommend using coordinates to calculate the distance

Glide already has a column to calculate distance for you live and in real time. You don’t have to do the math yourself. Just make sure you have a column with an address or a set of coordinates of the client. Then add a Distance column to compare that’s address/coordinates to your current location. Then you can set filters or visibility (such a visibility of a check-in button, based on the user’s distance to that location.

Glide’s solution is much simpler and doesn’t require you to use the location component, or any complex math. Just an address column and a distance column.

While it is technically true that you can’t track live coordinates of a user, the distance column will still work without having to use the location component to capture a user’s coordinates.


But in order for the above intended function to work well, is there a way to embed the [current location] to a button press so that it mimics the [set to current location] slider? I’m trying to create a check in form that detects whether my students are really in the physical campus when they hit the check in button.

You don’t need to capture the current location of the user. As long as location is enable in the browser and the app, the Distance column will work. You just need to compare the address of campus to the users current location. You can set visibility conditions for buttons or conditions in custom actions based on the distance radius.

You don’t need to mimic the Set Current Location switch because it’s not needed. You aren’t trying to get the user’s current coordinates. You are only trying to determine the user’s distance from a static location.

If a student is too far away from the campus location, then don’t even show the button to check in.

1 Like

Thanks so much for your prompt reply. Can I please clarify some things to better understand how to do this:

As long as location is enable in the browser and the app, the Distance column will work. You just need to compare the address of campus to the users current location.

How would this work if Glide does not support Live Location? Is there any other way to trigger the capturing of current location of the user apart from using the ‘Set Current Location’ switch? And does the user need to click the switch every time they check in or can it be a one time thing?

  1. Also this is feature is only available for Glide App not Glide Pages right? I noticed that under Glide Pages for the Distance column type there is an option to set ‘Current Location’ and the note appears that free accounts only get 10 per month… I assumed that the function would be the same as Glide App’s Location component but I was not successful in getting it to work the way I thought it would.

Thanks in advance~!

Glide supports live distance. Live location would require knowing the user’s actual location coordinates and being able to view it in the database.

You don’t need the switch, because you don’t need to aquire the user’s location coordinates.

The switch, yes. But like I said, you don’t need the switch. Just add a Distance column.

I’d have to play with it to say for sure, but I think that’s moreso if you have multiple rows. I also think it partly matters if glide has to geocode an address into coordinates. If possible, I would use the coordinates for the campus location instead of an address. That will eliminate the need for an address needing to be geocoded. Assuming you only have one campus location, then you only need one row and only that row needs to calculate a distance.

The location component is not yet available in Glide Pages — it’s one of the components that should be released in the next release or two. As far as I can tell, it needs to be pressed every time you want to capture the new “current location”. It won’t automatically capture a user’s GPS coordinates live (though that would be awesome) @jason.

Hi Jeff, I follow a lot of your comments in this forum and appreciate your help with my question.

Glide supports live distance. Live location would require knowing the user’s actual location coordinates and being able to view it in the database.

I actually do need to know the user’s actual location from the campus because I would like to prevent students clicking on the check in button from their home. This app is accessible by each students and will allow the students to check in when they arrive at the campus. I’m not sure what ‘Live Distance’ means but I’m guessing it will actively measure the distance between 2 addresses and updates automatically if one value changes. But I do need a trigger to detect if the student is current within the campus.

What I’m saying is that a distance column will always actively measure distance. You can choose to measure distance between two points OR measure distance between one point and the user’s current location. That second option does NOT require you to know the the students coordinates. It calculates it automatically. Based that distance number, you can control the visibility of the check in button.

In the settings for the distance column, From would be the location of campus and To would be Current Location.

Thanks for clarifying and for that screen shot.

I actually did set up the Distance column the same way you did in your example, however the user’s current distance from my predefined Point A to current location doesn’t show up. I’m not sure what I am doing wrong.

I have tried creating this column within the Users table and also on a Google Sheets table. Both remains blank even after I log in to the app using my phone.

I would place this in the table that contains the campus location. If you place it in the user table, then it’s going to unnecessarily calculate a location for each user row instead of doing it once on a campus row.

A couple of things to check:

  • Make sure the From location is a valid address. If you can, use coordinates as they can be more accurate.
  • You also need to make sure that location services are enabled on the device. If location is blocked, then it won’t work.
1 Like

Ok! I’ll try that. Would you be able to show me how would that table look like? Should be a standalone table with only 1 row or 1 row per user?

Well, I’d assume that you have a table with information about the campus. It can be that table, or it can be a separate table with a single row. Regardless, I’d probably use whichever table is the source of the screen that contains the button.

Ok! But considering there might be multiple students accessing the app at the same time, would it produce a problem where that one row might not reflect the right user? Or do I have to use user-specific column to make it work?

1 Like

It won’t matter. No you don’t have to use a user specific column for the distance column to work. The distance is calculated on the user’s device, (as with all computed columns) so the distance calculated will be unique to each user. The only time you need to use a user specific column is when you need a single cell to store unique values for different users. The distance column is not a stored value, and if you are calculating the distance from a single location to the user’s current location, then that distance will be different for each user.

1 Like

I have tried the suggested method and it seems like if I used my desktop, the current distance does work. But if I try logging in via my phone, the current distance doesn’t show up. Location permissions have been granted and the location icon does show up on my iPhone when I log into the app but the tables doesn’t reflect the distance. Any ideas?

How are you viewing the distance when you open the app on your iphone? Do you have a component showing the distance?

You are right. I realized I was looking at the table waiting for data to show when I should be assigning the column value to a field to show the column value off my phone. It seems to be reflecting right at the moment.

Thanks so much Jeff! (btw, how would I know how much more times i can use my free account’s calculate distance?)