Hello,
I have a survey for our field technicians to record information about traps they service. These trap locations do not change. Currently the survey has a drop-down menu that has them select the trap location from a list. This list is generated from a .CSV file that includes the lat/long of each trap. We've had issues in the past with the technicians selecting the wrong location, so I am attempting to find a way to automate this step.
I would like to find a way to have the location be automatically selected. Ideally, it would take their current location and calculate which location in the .CSV file is closest to them. Is such a calculation possible?
Thank you!
Solved! Go to Solution.
The search appearance has an intersects option but pretty sure it only works against a spatial layer that is a URL to a service. So not to a csv and they would need to be online. See here https://community.esri.com/t5/arcgis-survey123-blog/dynamic-choice-lists-using-search-appearance/ba-...
What we do is instead is calculate the distance from their current location to where they are supposed to be and then warn them in Red if it is too far. We do this as part of a Field Maps workflow where they tap the point and it passes lat/long into the form (you could look into this also as its good for helping crews find the location). You could do a pulldata to the csv based on the location they select then give a big red text warning if they are too far or even a constraint - but be careful if their GPS is off it could stop them.
The distance calc looks like this.. SampledMidLatitude is a pulldata from the geopoint question and DesignLat and Long are the static from the CSV (or Field maps).
round(acos(sin(${SampledMidLatitude} * pi() div 180)*sin(${DesignLat} * pi() div 180) + cos(${SampledMidLatitude} * pi() div 180)*cos(${DesignLat} * pi() div 180)*cos((${DesignLong} * pi() div 180)-(${SampledMidLongitude} * pi() div 180))) * 6371000,2)
Hope that makes sense and helps.
The search appearance has an intersects option but pretty sure it only works against a spatial layer that is a URL to a service. So not to a csv and they would need to be online. See here https://community.esri.com/t5/arcgis-survey123-blog/dynamic-choice-lists-using-search-appearance/ba-...
What we do is instead is calculate the distance from their current location to where they are supposed to be and then warn them in Red if it is too far. We do this as part of a Field Maps workflow where they tap the point and it passes lat/long into the form (you could look into this also as its good for helping crews find the location). You could do a pulldata to the csv based on the location they select then give a big red text warning if they are too far or even a constraint - but be careful if their GPS is off it could stop them.
The distance calc looks like this.. SampledMidLatitude is a pulldata from the geopoint question and DesignLat and Long are the static from the CSV (or Field maps).
round(acos(sin(${SampledMidLatitude} * pi() div 180)*sin(${DesignLat} * pi() div 180) + cos(${SampledMidLatitude} * pi() div 180)*cos(${DesignLat} * pi() div 180)*cos((${DesignLong} * pi() div 180)-(${SampledMidLongitude} * pi() div 180))) * 6371000,2)
Hope that makes sense and helps.
Thank you Doug, it does make sense. Marking this as a solution.
I do think I found another work-around as well and will post it here for future reference in case anyone else finds it useful:
What I did was make use of the Military Grid Reference System (MGRS). Survey123 allows you to set the precision levels at 1m, 10m, 100m, ect. I converted the lat/longs of each location to a MGRS number with 100m accuracy and added that as a column to my .CSV file. When the user takes their geopoint I have it converted to MGRS and simply have the survey match to the relevant location. It seems to be working as intended so far.
More information on using the MGRS can be found here: https://community.esri.com/t5/arcgis-survey123-blog/working-with-usng-and-mgrs-in-survey123-for-arcg...