Pass XY from feature in Collector to Survey123 form

5585
14
06-23-2017 08:04 AM
Status: Open
GISAdministrator22
New Contributor II

Would it be possible to pass the XY coordinates from a selected feature in Collector to a Survey123 form?  My current workflow entails selecting a feature (inlet, manhole, etc) from within a collector app and opening the associated Survey123 form through a custom URL to perform a field inspection.  It would be very beneficial to have the Survey123 point be in the exact location of the feature being inspected instead of relying on device GPS (although GPS is sometimes necessary).  I am referring to the inherent location instead of values from  X and Y fields, as this requires unnecessary overhead, i.e. auto-populate Geopoint values with coordinates passed from selected feature in Collector.

14 Comments
Carl_Flint

James & Mike,

You were both very much correct the precision setting in the popup configuration was set the the default 2 decimal places and setting that to max helped greatly.

Thanks.

JamesTedrick

Hi Christine,

The version of Collector that supports this has been released on iOS, though the web map used in Collector needs to be in WGS84 coordinate system.

JoshConrad1

All:

I have been experiencing the same issues described in this thread: trying to create an attribute expression that calculates lat/long coordinates from a hosted feature layer, then integrate Field Maps with Survey123 to open a form and have the geopoint plot the submitted survey on top of the feature using the result of the attribute expression using a custom URL via the custom URL popup (&center=).

I have been using the below formula, which is called out in a multitude of other posts on the community page and it was correctly calculating the coordinates in ArcGIS Online Web Viewer Classic, but then when we tested this functionality in the field, the point was not mapping:

var originShift = 2.0 * PI * 6378137.0 / 2.0;

var lon = (Geometry($feature).x / originShift) * 180.0;
var lat = (Geometry($feature).y / originShift) * 180.0;

lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return [lat, lon];

I found that this formula results in an Array data type, with associated brackets. These brackets do not show up in ArcGIS Online, but when you view the popup in Field Maps, you can see the brackets. So because of this, i tested further and in the original function, i removed the brackets in the return line, which worked but was not perfect. It was not perfect because the coordinate results ended up being truncated to 2 decimals, and even though the submitted form was executing, the point was being plotted hundred of feet away.

After 10 hours of testing and researching these threads (which by the way, all of the contributions are EXPONENTIALLY HELPFUL AND I AM SO GRATEFUL OF YOUR KNOWLEDGE) i was able to find the CORRECT SOLUTION:

1.) Create an attribute expression for latitude:

var lat;
var originShift = 2.0 * PI * 6378137.0 / 2.0;

lat = number(Geometry($feature).y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return lat;

2.) Create an attribute expression for longitude:

var lon;
var originShift = 2.0 * PI * 6378137.0 / 2.0;

lon = number(Geometry($feature).x / originShift) * 180.0;
return lon;

3.) Because of the "number" identifier, In ArcGIS Online Web Map Viewer Classic go to Configure Popups, make sure your pop up display is custom, then the important step is to click Configure Attributes. Navigate to the newly created expressions and expand the decimal places to a minimum of 5.

4.) Lastly, in the custom URL make the "&center={expression/expr3},{expression/expr4} where expr 3 is Lat and expr 4 is Long.

I have been testing since i discovered this and it has been running smoothly. Happy Mapping!

OscarGaleas

Hello i have the same inquiry but i'm trying to auto-populate the x_y from a web layer in AGOL so it plots at the same place in Survey123 for a specific point. Any help with this would be greatly appreciated..