How to generate vertices array from existing feature service to populate URL and pre-fill survey123 (similar to passing X,Y as geopoint) either in Collector or WebMap with the new GeoShape functionality

1024
7
Jump to solution
05-01-2020 06:52 AM
JeffHill
New Contributor II

I am trying to develop a workflow where 1 group of field staff are creating polygons on a web service, then a different group of staff use those polygons to pre-fill some answers on a Survey123 form via a custom URL in the popup for the web service. They then add the remaining attributes that are unique to the survey. 

Is there a way to include the array of vertices so I can keep the polygons' shape as a geoshape when doing this workflow. I have seen examples of a point feature being used to pre-populate a geopoint and the geoshape tool can handle individual vertices as an answer. So, the question really is this: can I calculate the set of vertices (or rings) for a feature service inside the popup URL? 

0 Kudos
1 Solution

Accepted Solutions
BrettStokes
Esri Contributor

Hi Jeff,

This is possible using an Arcade function. See my response to this post (Can't pass attributes of a line from Collector to S123) for instructions and let me know if you have any difficulties.

Brett

View solution in original post

7 Replies
BrettStokes
Esri Contributor

Hi Jeff,

This is possible using an Arcade function. See my response to this post (Can't pass attributes of a line from Collector to S123) for instructions and let me know if you have any difficulties.

Brett

JeffHill
New Contributor II

Thanks Brett this does exactly what I need! I will give it a try. 

0 Kudos
JeffHill
New Contributor II

EDIT: still have not successfully passed vertex coordinates, but I am getting closer (I think). My URL is formatted as follows: 

href="https://survey123.arcgis.com/share/ITEMIDFORTHISSURVEY?field:forester={Forester}&field:county={CountyName}&field:TractID={TractID}&field:TractIDOwner={TractIDOwner}&field:contactname={Contact}&field:phone={Phone}&field:lastname={LName}&field:firstname={FName}&field:billingaddress={MAILADDR}&field:city={MAILCITY}&field:billstate={STATE}&field:zip={ZIP}&field:prescshape={expression/expr0}" rel="nofollow ugc" target="_blank">Survey</a>

When I click on a link I get something that looks correct, but the prescshape portion does not feed the geoshape question. Sample:

field:prescshape=35.4955258942163%20-87.5681752757275%3B35.4950675536209%20-87.5676845847538%3B35.4947421087082%20-87.5669107375285%3B35.4946169958997%20-87.566460080437%3B35.494379472624%20-87.5664859347469%3B35.4943576193721%20-87.5663279040195%3B35.4938221903351%20-87.5664020849691%3B35.492710134173%20-87.5651471135985%3B35.492629012388%20-87.5650043600433%3B35.4925177594041%20-87.5650093756438%3B35.4924708154302%20-87.5650114932778%3B35.4923333822456%20-87.5650133470965%3B35.492196113227%20-87.5650151930967%3B35.4920032459885%20-87.5650122847069%3B35.4917848684347%20-87.5650148218964%3B35.4914895478976%20-87.5650571345101%3B35.4911041546988%20-87.565152930548%3B35.4906919122361%20-87.5652441245214%3B35.4903971322406%20-87.5653075395817%3B35.4901732757527%20-87.5653478951432%3B35.4899640116653%20-87.5653872440876%3B35.4897108946538%20-87.5654006673887%3B35.4895228284514%20-87.5653992816348%3B35.4894372217978%20-87.5653986510658%3B35.4892455562097%20-87.5653706581132%3B35.4899731296116%20-87.5723649400834%3B35.4899818296485%20-87.5724936212071%3B35.4901240201227%20-87.5745968034005%3B35.4901316402109%20-87.5746803685207%3B35.4901853536605%20-87.57468166231%3B35.4909258953967%20-87.5746994886018%3B35.4926578073569%20-87.5747411798059%3B35.4941609973115%20-87.5747720836959%3B35.501438917406%20-87.5749217188128%3B35.5010651758694%20-87.5708914725461%3B35.4990623446986%20-87.5710854964727%3B35.4989435398418%20-87.5697592053288%3B35.4979689987506%20-87.5694520711889%3B35.4972622427425%20-87.5692957500453%3B35.4955258942163%20-87.5681752757275

The map simply says "no geometry captured yet"

prescshape is a required question

Brett, again thanks for your help.

I am able to calculate all the vertices in the expression you provided, but I am experiencing a few issues still that you may be able to help me with! 

First - The coordinates don't appear to be correct. You mentioned that the basemap projection must be in WGS84 but I'm not sure which basemap options are in that projection. The format that is passing through the URL is: field:prescshape=4341177.19021595%20-9728707.27950999%3B4341117.33651334%

 EDIT: I created a new map with the correct basemap projection so my coordinates are now in the correct format. 

Second - There are mixed results with the URL scheme - once I had a 494 error, a few times I got other errors but I think I have solved most of those... however, I still have not succeeded in capturing the geometry, 

EDIT: The 494 error appears to be due to length of the URL, I changed the field length for the polygon and now this seems to only be an issue on the most complex polygons.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Jeff,

On the coordinates format - the Arcade geometry functions work in the coordinate system of your web map (which in turn is controlled by the spatial reference of the basemap layers) ; you would need to use a WGS84 basemap to get decimal degrees or have a conversion function for the spatial reference you are using.

0 Kudos
JeffHill
New Contributor II

Hey James thanks for the info. Are any of the basemaps in the generic basemap gallery in that projection? 

0 Kudos
JoeLemeris
New Contributor II

Hello! has there been any resolution to the above comments (from May 7th)? I seem to be having the same issue - trying to pass polygon geometry to survey123 web form, yet nothing seems to be filling in the appropriate geoshape field. basemaps are set to WGS84, using the arcade code as mentioned above. 

0 Kudos
I_Hack
by
New Contributor

I'm having the same issue.  The geoshape question field does not receive the coordinates from the feature layer polygon geometry.

0 Kudos