Survey123: Draw Geoshape and Populate County Name it Intersects

592
3
07-18-2023 07:33 AM
AnninaRupe1
New Contributor III

Hello! I've been doing a lot of research this morning on my problem, and I think there's a solution out there but everything I've come across is a little bit different of a situation and I need some help!

I have started a survey in Connect. In this survey, the user draws a polygon and answers questions about practices they want to employ in that area. I am using Power Automate to direct the sites to be reviewed by the appropriate person. To utilize this to the fullest extent, I need to have a question about the county the area is in. I currently have it as a question for the user to populate, but I want to make it as automated as possible. I would like a hidden field to be populated with the county name based on the polygon the user draws.

I have done this before using a geopoint--that's easy! However, the change to a geoshape makes things a little more tricky. I think the necessary workflow is to first get the centroid of the polygon and then pass those coordinates to another field to get the county name, but I'm not sure. And the things I've tried (e.g. pulldata) haven't worked. 

Any ideas? I'm open to other workflows, too. 

@IsmaelChivite 

Tags (2)
3 Replies
mcrow_LJA
New Contributor

There are likely many ways to do this, but one thing we have been successful with is reverse geocoding within Survey123 forms.  You could pull the centroid from the new polygon and add it to a url which will pull the address and other info for that coordinate and then you can use it in your form.  Here is an example of a lat long being passed to the esri geocoding service which will return many outputs including the Subregion which appears to be the county: https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTy...

This is a good article on the subject: https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?f=pjson&featureTy...

and here is some info of how to suck this into the Survey123 form: https://community.esri.com/t5/arcgis-survey123-blog/understanding-reverse-geocoding-in-survey123-3-0... 

0 Kudos
AnninaRupe1
New Contributor III

Thanks for the information! I did notice in the blog post, though, that using the Esri geocoder consumes credits. I was hoping there was a solution that didn't, as I have the county data available to me already.

I think the biggest hurdle is trying to get the coordinates of the centroid of my polygon. Any ideas on how to pull that?

0 Kudos
IsmaelChivite
Esri Notable Contributor

@AnninaRupe1  Getting the centroid of a polygon with an XLSForm expression is not possible at the moment. You may want to vote up (if not already) this idea: https://community.esri.com/t5/arcgis-survey123-ideas/create-centroid-point-at-the-creation-of-geosha... 

0 Kudos