# Comparing GPS coordinates in Survey123

1013
7
10-30-2021 12:21 PM
New Contributor III

Is there a way in Survey123 to compare the spatial distance in meters between 2 GPS coordinates (on fixed GPS coordinates and the other one is the actual location of the device/enumerator)?

If the distance is, say, more than 30m, show an error message "You are far away, please go to the designated location"?

1 Solution

Accepted Solutions
MVP Esteemed Contributor

Here I send in the DesignLat/Long and compare to the current (which someone called easting/northing and it drives me nuts).  Can compare any 2 with it.

round(acos(sin(\${Northing} * pi() div 180)*sin(\${DesignLat} * pi() div 180) + cos(\${Northing} * pi() div 180)*cos(\${DesignLat} * pi() div 180)*cos((\${DesignLong} * pi() div 180)-(\${Easting} * pi() div 180))) * 6371000,2)

meters

7 Replies
MVP Esteemed Contributor

Here I send in the DesignLat/Long and compare to the current (which someone called easting/northing and it drives me nuts).  Can compare any 2 with it.

round(acos(sin(\${Northing} * pi() div 180)*sin(\${DesignLat} * pi() div 180) + cos(\${Northing} * pi() div 180)*cos(\${DesignLat} * pi() div 180)*cos((\${DesignLong} * pi() div 180)-(\${Easting} * pi() div 180))) * 6371000,2)

meters

New Contributor III

Thanks

Does it work if one of those GPS coordinates (DesignLat/Long) are taken from Collector app through a custom URL scheme using the &center or Survey123 will be lost here?

MVP Esteemed Contributor

I send these using a URL.  Just send it into a field in the form then compare.

New Contributor III

Doesn't the center (&center=43.567,-117.380) in the custom URL sets ALL the geopoint questions to those coordinates? In that case, should I sent those coordinates from the Collector app to a text field in Survey123 and then compare?

MVP Esteemed Contributor

Yes do not use center just send them as text into a field in the form.  Then have a second set of lat/long using pulldata to get the form GPS lat/long.  Then compare those 2 fields.  Sorry that was not clear.

New Contributor III

Thanks for the explanation. On a side note, can we collect the GPS automatically (hidden way) without showing or clicking on the GPS button or map in the form (using the field app)?

MVP Esteemed Contributor

I think you can hide the GPS question using the new body::esri:visible column.