Collector Passing Field to Survey123 Help

2498
5
04-23-2018 02:13 AM
ZakPoulton
New Contributor

Hello All,

I need help with Survey123 and Collector. I did the setup a little backwards. I have feature layers in a webmap published to use in collector and I created a survey. I am now trying to join the two feature services. I just need one field to match and I will be okay, after all this is a simple dataset and will only be using the survey123 forms in the end. I currently have users saving a waypoint to one of the feature classes in collector and then using the custom URL to access Survey123. Reading all the blogs and comments I first tried using the URL to link to a field "NestID" but since this is unique ID and a text field all I get is ${}, so I tried adding {Name} and that is all I get. I realize now from reading that it needs to be a "selected one" or multi. Is that right? So then I tried passing x,y to auto pop by using center={}. Again I only get the brackets. I now realize that xy needs to be in the same field. For the life of me I can not figure out who to do that to where it will auto populate. 

I also tried recreating the survey linking it to the feature service online in the beginning. This work but will not let me publish because I have repeats and need them. 

We need collector to navigate back to the found bird nest but we want to use Survey123 for data collection. Can someone please help me  connect the two dots.

Sorry if this has been covered. I have gotten lost in all the post and after two weeks I am tried of beating my head against the wall. 

Thanks,

Zak

5 Replies
ZakPoulton
New Contributor

I was able to pass newly collected coordinates from Collector to Survey123. I missed it in https://community.esri.com/groups/survey123/blog/2016/07/30/understanding-survey123s-custom-url-sche... 

If you want to pass lat/lon values from the geometry in a feature, you can add an Attribute Expression to your popup do dynamically get the lat/lon values from the geometry of your feature.
   1) 
Open the 'Configure pop-up dialog of your feature layer's and then select 'Configure Attributes'.
   2) Add a new Attribute Expression.
   3) Look for Geometry under the Globals tab and fetch Geometry($feature).x
   4) Use the Edit link at the top to give your expression a friendly name
   5) Repeat steps 2 through 4 to create a second expression for the y coordinate.

Now if I could get Survey123 to pass fields back to Collector in the popup as read only. That way observers can review the last recorded before conducting a new survey. Can this be done?

AlinaTaus
Occasional Contributor

Hi Zak,

I am trying to figure out how to pass the lat/long from the geometry of another point feature to my Survey but I'm not having good luck with it. So following the notes in the blog post you mentioned, once you set up the Attribute Expression to get the X and Y, was there anything else you needed to do to get your survey point to center at that location? I assume I need to specify something in the custom URL after "center=" but I'm not sure... Any help is much appreciated!

Alina  

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Alina,

You may want to look at https://community.esri.com/thread/188510-survey123-with-collector-set-geopoint#comment-839398 - Doug pretty well covered some of the known hiccups of using Arcade's X & Y functions

0 Kudos
AlinaTaus
Occasional Contributor

Thank you James! I ended up using the first method that uses existing X and Y coordinates in the attribute table of the point feature class. My basemap is in a projected coordinate system so I figured I can use Calculate Geometry to get my local X and Y which then I can pass to my Survey123. That ended up working fine for this project. I will definitely look into the post you referenced as a quicker way to set it up for future surveys. 

0 Kudos
JoshConrad1
New Contributor III

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 "Expression/expr2 - Code to calculate geometry" formula called out in this post (and a multitude of others 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.

I found that the original formula in the "Expression/expr2 - Code to calculate geometry" 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 result 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!

0 Kudos