I successfully initiate collection of lines and polys in Collector via a link in my Survey123 survey. But how do I then record the OID (or a unique identifier) of the line/poly collected in Collector back to my survey, so I can link the data collected in the survey to the spatial feature (line/poly)? Is there a way to do this?
Send the ID you decide to use via the URL also. Then create a Relationship class in the Hosted Feature service that links the form feature class to the collector feature class. (If you need to publish a service that has both of the feature classes and relationship class then repoint your form to it).
Doug, I could really use some extra guidance. Perhaps I'm doing something wrong. I created the survey via a spreadsheet, published it, created 1 record (just so I could download it), downloaded it to gdb. In ArcGIS, I then add the line and poly feature classes, create relationship classes between the point fc and the line/poly feature classes.
How do I then repoint my form to the gdb that I updated, as you suggested? I tried Add Item to upload the altered gdb, but that creates a new feature layer rather than updating the existing. I then tried creating a survey from the new feature service, but much of the survey did not work, probably because of the extra 'Special' and 'Restricted' warnings I received.
So what am I doing wrong?
I would be ever so grateful for your help!
You need to publish that GDB as a feature service. then get the URL of that feature service and add it to the settings page of the survey to repoint it. you are creating a new one in pointing to it you are not editing the one created by survey. You are simply repoinging it to a new service that you created. Hope that helps
Following is the entire process which I have used to clarify things. Now I get an error when Collector is open and neither the lines nor polygons are available for editing. See the error at the end.
<a href="arcgis-collector://?itemID=413fcac1c13947819a0531cee502b4fa&featureSourceURL=https://services.arcgis.com/EVsTT4nNRCwmHNyb/arcgis/rest/services/Source_Features_AllTypes/FeatureSe...">Map a Line</a>
Given that the above process (i.e. downloading survey gdb, adding polygon fc and creating relationship class, republishing and updating survey to point to new survey URL) resulted in the error above (i.e. Invalid Feature Service Schema) when opening in Collector, I tried two more things.
First, I created a fc with parentglobalid as GUID field in ArcMap and using Add In in AGOL to publish the map service, which resulted in the same error as above (Invalid Feature Service Schema) when calling it in Collector via my survey.
Second, I created a feature layer in AGOL, added it to a map and called it in Collector via my survey. That works, and is what I had originally done, but then I'm still in the same predicament of not being able to relate the polygon feature with my survey, which is what I was trying to do with the parentglobalid field. Given that a string field can't join to a Global ID field, I can't just add the globalid from the survey to a string field in the feature layer (via the call to Collector) and be able to join back to the survey data.
The only difference I see between the two methods that fail and that which works is the inclusion of the "parentglobalid" GUID field which I assume is what is causing the feature service schema to be "invalid". But if I don't include that, again, I can't link the feature back to the survey.
Trying to sleuth this further, I verified that Supports applyEdits with GlobalIds: True for the hosted feature layer which contains the points, lines, and polys.
If I create a webmap containing just the line layer (within the hosted feature layer with the related classes between the survey (point) and polygon/line), then "There are no collectible layers visible. Check layer visibility or your map scale" is displayed, despite the fact that min & max scale are set to 0 and default visibility is set to True.
Could you check the layer numbers in the new feature service - it looks like they may be different than the original service. You may need to adjust the web map and reload the map in Collector.
I started from scratch: create the survey from the spreadsheet, add a record, download the data to gdb to add the poly & line fcs and relationships. Add the gdb to AGOL, publish the webmap (without making any changes!), share, etc. I copied the URL of the hosted feature layer, which has been shared, edits allowed, etc. to the URL of the form. In Survey123 Connect, I opened the spreadsheet and added notes to link to Collector to collect the lines and polys, and although I no longer get an error (progress!), neither the lines nor polys are displayed in the Collector map for editing. So, I looked at the details for the hosted feature layer and Supports applyEdits with GlobalIds: True. Any suggestions? Although I can collect data and no longer get errors when opening Collector, I still can't collect lines or polys in Collector.
Here are some details
Note to call Collector:
<a href="arcgis-collector://?itemID=9824d82442c64c498c2b404ef3e719c3&featureSourceURL=https://services.arcgis.com/EVsTT4nNRCwmHNyb/arcgis/rest/services/ea7e7ca50e7b48ea9fbbc17825fe123c_gdb/FeatureServer/1">Map a Polygon</a>
In the following screenshot you can see that I renamed the layers in the Map, but it wasn't working before renaming and still isn't workig afterwards. Just
I finally determined that the layers were not displaying due to the Filter types Setting in Collector. Turning it off displayed and allowed me to collect the line and polygon layers in Collector.
My next problem is passing the GlobalID from the survey to Collector. I'm doing so using the following syntax in a NOTE field, but I'm guessing I have the syntax wrong to pass the value from the globalid field (point fc in survey) into the parentglobalid field (line, poly fc) (i.e. &featureAttributes=%7B%22parentglobalid%22:globalid%7D) . The Collector integration document only indicates how to pass static data to an attribute, not data values form a field, as I'm trying to do with globalid. BTW, these fcs are all related and contained within the hosted feature layer that the survey form is pointed to (source URL).
<a href="arcgis-collector://?itemID=990f6e5ad7ad470594415fa78a0b6f49&featureSourceURL=https://services.arcgis.com/EVsTT4nNRCwmHNyb/arcgis/rest/services/484ee6b2c4134fb3a1ae9b4c1e8fc649_gdb/FeatureServer/1&featureAttributes=%7B%22parentglobalid%22:globalid%7D">Map a Polygon</a>
Then it occurred to me that I shouldn't have to do this because it should automatically happen with the relationship class. But downloading the gdb of the survey revealed that although I had pointed the survey Form to the URL of the hosted feature layer, the related feature classes were not included in what I downloaded. So, I added the submission_url and form_id information to the settings tab of the spreadsheet to match the hosted feature layer and successfully republished the survey.
I collected a couple lines & polys and then went to manage the survey in the Survey123 website and the line & polygon data is displaying way far away (i.e. the ocean near Africa versus Virginia), despite the fcs having the same projection. And when I try to export the survey to gdb to verify that the lines and polygons are included, the export fails:
So, I'm making small progress but am still stumped. Any more suggestions?
Unable to export my survey to gdb via survey123.arcgis.com (see error above), I tried another way. Interestingly, I was able to successfully download the survey to gdb via the Python script referenced in this document, but the parentglobalid was not recorded in my line/poly from the survey despite the relationship class I had defined. Highly frustrating! I must still be missing something or not have something configured correctly. Any suggestions?