Custom URL parameters passing value to Collector?

5774
14
12-11-2017 08:38 AM
BrentKinal1
Occasional Contributor III

I've been playing around with linking to Collector from Survey123 and the GitHub documentation for Collector custom URL scheme shows that it is possible to both center on a coordinate and pass static attributes to a layer within a web map in Collector. The GitHub documentation however doesn't show how to pass values collected in Survey123 to Collector, similar to the way values can be passed from Collector to Survey123, just curious if this functionality has yet to be implemented or if someone has an example on how to center the map on the geopoint coordinate and send an attribute (GUID) value collected with Survey123 to a feature in Collector?

14 Replies
TiffanyRufo
Occasional Contributor II

Understanding Survey123s Custom Url Scheme

Best post documentation on how to do it so far. My go to.

0 Kudos
by Anonymous User
Not applicable

I believe they have updated the GitHub site for the Collector URL schema to include how to pass data into Collector.

GitHub - Esri/collector-integration: Multi Language repository that contains documentation and sampl... 

I will be looking into this as well.

Good Luck

0 Kudos
BrentKinal1
Occasional Contributor III

Thanks Tiffany and Mike, I have been working off both the links you sent. Unfortunately neither really explains if there is a way to dynamically write an attribute collected in S123 to Collector. The URL going from S123 to Collector is slightly different than the converse. The GitHub page does show how to write a static value from S123 to the attribute table in collector, which I have been testing so far without success so far. If I get it to work I think I can put something together using concat() to build the link to dynamically pull a value (a GUID) collected in S123 and populate it in the Collector feature, with the ultimate goal of having a relationship class built between the S123 feature and the Collector feature using the GUID. If I am ultimately successful I will share how I did it.

by Anonymous User
Not applicable

I might have sometime to play around with this also, but it will not be until after next week during our Holiday shutdown; it's the time that I our company shuts down and I get to develop and test away without interruptions, and if I happen to figure something out, then I'll post to this thread also.

Good Luck,

Mike

ScottKichman
New Contributor III

Hi Brent, did you ever figure this out?

0 Kudos
by Anonymous User
Not applicable

Hey Scott,

I have not had the chance to work with this issue, but I have found that they have updated the URL schema for passing information into Collector app. The key will be creating a hyperlink that will concatenate a URL that represents the "expected" URL string that collector is listening for.

Within the link that I provided above; as you scroll down the page to here GitHub - Esri/collector-integration: Multi Language repository that contains documentation and sampl... you will see the URL string that Collector is expecting.

Within this posting I discuss a way to create a URL link to send an email, but you can modify the "Hyperlink" in order to concatenate the sending of data from a Survey123 form into the Collector app. 

Not your standard "Note" question; email link 

Really take some time to look at the structure of the URL for collector and understand how you can sub in your attribute field names and then the values being passed. You will need to know the URL to the Feature Service Layer along with the data field names (i don not believe you can use the alias field names in passing this information) and the values. When looking at collector you will need to substitute in the question name and then the answers of the questions; similar to my hyperlink for an email.

Quick breakdown of this URL - arcgis-collector://?itemID=5d417865c4c947d19a26a13c7d320323&center=43.524080, 5.445545&featureSourceURL=http://sampleserver5a.arcgisonline.com/arcgis/rest/services/LocalGovernment/Recreation/FeatureServer/0&featureAttributes={”quality”:2,“observed”:1502917218285}
This portion = the unique AGOL identifier for the Hosted Feature service "arcgis-collector://?itemID=5d417865c4c947d19a26a13c7d320323"
This is telling the Collector app to start the new feature at this coordinate pair "&center=43.524080, 5.445545"
This is telling collector which layer to start and write the information to; please note that the layer index at the end of the url "&featureSourceURL=http://sampleserver5a.arcgisonline.com/arcgis/rest/services/LocalGovernment/Recreation/FeatureServer/0"
These are the attributes being passed "&featureAttributes={”quality”:2,“observed”:1502917218285}"
Data field named "quality" and then the value to be written "2"
Data field named "observed" and then the value to be written (date in epoch time) "1502917218285"

Sorry that I cannot provide any further details or example currently as I have been playing catch up for the last month on a high priority project and developing these types of applications for our upcoming field season starting in less then a month.

Give it a shot and let me know if you are still having issue figuring things out.

Good Luck,

Mike

0 Kudos
BrentKinal1
Occasional Contributor III

Hi Scott,

I did finally figure this out. Basically you have to build the URL within a concat function. The hard part was figuring out all of the html encoding: here is the reference that helped with that:

HTML URL Encoding Reference 

 Basically I built a Geodabase in Pro with a relationship class built between the survey and the polygon feature and then uploaded it as a AGOL feature service. The relationship was built between a GUID created in Survey123 which is then passed to Collector using the custom URL:

Here is the final statement that I ended up with:

concat('<a href="arcgis-collector://?itemID=00x00xx0x0xx000x0x000000x00x0000&featureSourceURL=https://services6.arcgis.com/ZZZzzZz1zzZZ1zzz/arcgis/rest/services/SPB_S123v1/FeatureServer/2&featur...{pointID},'%22%7D">Create Survey Polygon</a>')

Breaking it down:

'<a href=......</a>' =  Hypertext reference

arcgis-collector://?itemID=00x00xx0x0xx000x0x000000x00x0000&featureSourceURL=https://services6.arcgis.com/ZZZzzZz1zzZZ1zzz/arcgis/rest/services/SPB_S123v1/FeatureServer/2 = web map id & polygon feature service url

featureAttributes=%7B%22surveyPointID%22:%22',${pointID},'%22%7D> = write value from Survey123 "pointID" to polygon field "surveyPointID"

translates to: featureAttributes={"surveyPointID""',${pointID},'"}>

Create Survey Polygon = hyper link text in Survey123

Let me know if you have any questions.

by Anonymous User
Not applicable

Brent,

I am just now getting around to this and I am having a hiccup with the process - I can launch a Survey123 form, fill it out, then tap on my hyperlink to transfer the information, Collector Opens up, but I am having an issue with getting the point to be placed and attributes transferred?

I wonder if it has to do with a unique display based on an attribute field; TlmtryPntType? DO I need to fully encode the answers that are being passed also? If so, then I'll need to add in some

Jeff Shaner or Craig Gillgrass‌ do you have any ideas on this one?

Here is my original concat () string below that I was going to use for my hyperlink from Survey123 into Collector to start a new feature and pass attributes. I have taken out the "identifiers" on purpose and replaced with a series of "X".

concat('<a href="arcgis-collector://?itemID=XXXXXXXXXXXXXXXXXXXXXXXX&center=',${lat},',',${lon},'&featureSourceURL=https://services3.arcgis.com/XXXXXXXXXXXXXX/arcgis/rest/services/2018_ESI_Mist_Net_Bat_Data/FeatureS...{"ProjectNumber":',${ProjectNumber},'"TlmtryPntType":Telemetry Intermediate Point,"Date":',${FormDate},'"BatID_Freq_Srchd":',${BatFreq_Searching},'}">Link to Collector Telemetry Point</a>')

Here is my revised filly encoded; or possibly not, concat () string.

concat('<a href="arcgis-collector://?itemID=b0a360a4dc8749d9a0d88af86ceafdd5&center=',${lat},'%2C%20',${lon},'&featureSourceURL=https://services3.arcgis.com/pmvd6IDs5lq7p0BT/arcgis/rest/services/2018_ESI_Mist_Net_Bat_Data/Featur...{ProjectNumber},'%22TlmtryPntType%22:Telemetry%20Intermediate%20Point,%22Date%22:',${FormDate},'%22BatID_Freq_Srchd%22:',${BatFreq_Searching},'}">Link to Collector Telemetry Point</a>')

Any help would be greatly appreciated as I'm trying to implement this for my field crews this week.

Thank you in advance!

Mike

UriGilad_EsriAu
Esri Contributor

I wrote a simple script (attached) that produces the URL (mentioned in this post by Mike J Bruening and Brent Kinal) to match between the fields in your Survey123 form to a layer in a web map in Collector.

If you're already familiar with working with the URL just fill the csv file with your fields, change the variables in the script to match your data and run the script to get the URL.

For those who are not familiar, below is a step by step workflow to get the two apps talking to each other.

----------------------------------------------------------------------------------------------------------------

This methodology will allow you to enjoy the advantages of Survey123 in capturing form/text data, with the advantages of Collector in capturing geometries. This method also allows you to associate multiple geometries with one survey, which is impossible from Survey123.

It might seem like a long process but it's fairly straightforward and easy. Steps 1-4 should already be accomplished anyway if you published and used your survey.

Use:

Transfer Survey123 inputs into a feature's fields in collector.

Workflow:

  1. Create a survey.
  2. Note all the survey field names that you wish to write into the feature class attribute table (that will be created later in Collector).
  3. Create a feature layer with matching fields into which the Survey123 data will be written to (field names can be different but make sure field types match). Make sure the feature class is editable.
  4. Add the feature class into a web map and download to Collector. Only fields visible in the popup could be populated in later steps. Make sure in Settings page that you can open map in Collector.
  5. In a CSV file, list the fields to match between the survey and the feature class (you can modify the attached CSV example).
  6. Run the attached script (after filling lines 24-28 with your input: path to the CSV, web map ID, feature class url, and survey location field).
  7. The script will produce a url (starting with <href...). Copy the URL into a new row in your survey (paste the url in the 'Label' column). This row will be a hyperlink that will open collector and populate all the fields with your survey data.
  8. When you finish the survey click on this hyperlink. It will open Collector at the location of the survey and will allow drawing the feature with Collector, writing it into the specified layer. Fields from Survey123 will populate the feature layer fields in Collector.
  9. Draw the feature in Collector and click submit to save to layer.
  10. Go back to Survey123 and submit survey.

Note that this workflow will results in a point layer created by the survey in Survey123, in addition to the feature layer which is updated in Collector (which can be polygon/line/point).

Any comments/feedback is welcome,

Uri