Survey123 & Workforce - Location Validation as part of survey

676
4
Jump to solution
01-24-2020 03:40 AM
by Anonymous User
Not applicable

Hello - my first question on the Esri Community!   

I'm currently working with Survey123 & Workforce and I'm wondering if there is a way of including a location validation question - e.g. at the begining of the survey the user has to set their location and it must be within x metres of the point that has been assigned to them via workforce. This seems like something that might be useful to lots of users so I'm wondering if someone has previously come up with a solution?

I'm wondering if exploring something along the lines of the below would potentially work? (where the 100 value would be my validation criteria);

TargetX/TargetY are points pulled in from Workforce

X = pulldata("@geopoint", ${location}, "x"

Y = pulldata("@geopoint", ${location}, "y"

Set the following as "relevant" criteria in a validation question -  ${X} = <(${TargetX}+100) OR >(${TargetX}-100) AND ${Y} = <(${TargetY}+100) OR >(${TargetY}-100)

Any thoughts would be greatly appreciated!

Tom

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

Yep I do this.  I use some radians math I found on geonet.  I have my design lat/long (where we told them to go) in Collector then I pass that lat/long over to my 123 form.  Then in the form I do math and display how far away they are from where they should be.  Then I set a field that appears if they are more than 50 meters away to ask if they are moving a plot.  Each time they tap the GPS button the distance recalcs.

Make sure to use WGS84 for everything.

GPS question is GPSPlotCenter

Northing - pulldata("@geopoint", ${GPSPlotCenter}, "x")

Easting - pulldata("@geopoint", ${GPSPlotCenter}, "y")

Then DesginNorthing and DesignEasting come from Collector

Distance calc.   Field DistanceFromDesign

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

Then I change my moved question from no to yes using a calc.  You could do this as a constraint.

if(${DistanceFromDesign} > 10, "Yes","No")

You could factor in GPS accuracy if you want.  I usually set a constraint on this also so I know they had a good signal.

pulldata("@geopoint", ${GPSPlotCenter}, "horizontalAccuracy")

Hope that helps works great for us.

View solution in original post

4 Replies
DougBrowning
MVP Esteemed Contributor

Yep I do this.  I use some radians math I found on geonet.  I have my design lat/long (where we told them to go) in Collector then I pass that lat/long over to my 123 form.  Then in the form I do math and display how far away they are from where they should be.  Then I set a field that appears if they are more than 50 meters away to ask if they are moving a plot.  Each time they tap the GPS button the distance recalcs.

Make sure to use WGS84 for everything.

GPS question is GPSPlotCenter

Northing - pulldata("@geopoint", ${GPSPlotCenter}, "x")

Easting - pulldata("@geopoint", ${GPSPlotCenter}, "y")

Then DesginNorthing and DesignEasting come from Collector

Distance calc.   Field DistanceFromDesign

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

Then I change my moved question from no to yes using a calc.  You could do this as a constraint.

if(${DistanceFromDesign} > 10, "Yes","No")

You could factor in GPS accuracy if you want.  I usually set a constraint on this also so I know they had a good signal.

pulldata("@geopoint", ${GPSPlotCenter}, "horizontalAccuracy")

Hope that helps works great for us.

by Anonymous User
Not applicable

Thanks for the response - ignore my previous question, have worked that one out!

Will mark this as answered - thanks again Doug!

DougBrowning
MVP Esteemed Contributor

Sorry I edited my post to be more clear.  It is in meters I just said feet in generic terms.

If you want all the gory details I dug up the post here.  

https://community.esri.com/groups/survey123/blog/2018/01/10/calculating-distances-between-multiple-g... 

It does work though.

0 Kudos
by Anonymous User
Not applicable

Thanks - sorry I realised it was in meters once I started doing some testing, so I removed my original reponse!

0 Kudos