Create Point-in-Polygon using an Address Location in ArcGIS Survey123
Imagine you need to search a location’s City Code, zone, region or any named area but don’t want to manually pinpoint it on a map. By just typing an address, you can now instantly retrieve this information with a query! In this blog, we’ll walk through a seamless solution where an address input triggers a point-in-polygon query, retrieving the area information directly from a defined feature layer. Say goodbye to maps—this streamlined, automated lookup simplifies data access and enhances your workflow in ArcGIS Survey123.
In this blog, we'll use sample data from dog off-leash parks (City of Vancouver Open data Portal). By simply entering an address, you'll see how our query returns the name of the park associated with that location. This setup can be implemented using either Survey123 Web Designer or Survey123 Connect.
In ArcGIS Survey123 Web Designer
-
Add an Address question to your survey (Question name: Address)
-
Add a Singleline text question to your survey (Question name: Dog off-leash Parks).
-
Select the Singleline text question, under the Edit tab, click the edit button next to Calculation.
Setting up a calculation field in survey123 form
-
Select Layer for the source and choose the polygon feature layer you’d like to use. Select the desired Output field, then click OK to save.
Configuring data extraction from a specific layer to retrieve the desired output field
-
Toggle ON the Set filter and connect it to your Address_geopoint question.
Applying a location-based filter to extract data using specific attributes
6. Save your change and publish the survey.
The video demonstrates the outcome in Survey123 Web
In ArcGIS Survey123 Connect
-
Start by creating a blank new survey in Survey123 Connect and open the XLSForm.
-
In the first row, set the question type to text for entering the address location. Under the appearance column, select geocode.
Set up question for entering Address
-
In the second row, add a geopoint question. Set the appearance to hidden so this field doesn’t appear in the survey.
Set up The Geopoint question
Under Calculation column for this row, use the following formula to extract coordinates:
concat(number(pulldata("@json",${TextName},"location.y"))," ",number(pulldata("@json",${TextName},"location.x")))
Replace ${TextName} with the name of your text field. For example,
concat(number(pulldata("@json",${address},"location.y"))," ",number(pulldata("@json",${address},"location.x")))
For more information about pulldata("@geopoint") function, please click here.
-
In the third row, add a text question to display the result.
Set up Question for generating Address result
Use the following pulldata function in the calculation column for this row to pull data from a feature layer based on the location:
pulldata("@layer", "getValueAt", "attributes.FIELD", "FEATURESERVICE", ${GEOPOINTNAME}, "")
Replace "attributes.FIELD" with the field you want to retrieve, and "FEATURESERVICE_URL" with the URL of your feature service. Also, replace ${GEOPOINT_NAME} with the name of your hidden geopoint field. For example:
pulldata("@layer", "getValueAt", "attributes.name", "https://services.arcgis.com/EgePHk52tsFjmhbJ/arcgis/rest/services/dog_off_leash_parks/FeatureServer/0", ${address_geopoint}, "")
For more information about pulldata("@layer") function, please click here.
How the pull-data function works under Survey123 Connect XLS form
5. Save your change and publish the survey.
The video demonstrates the outcome in Survey123 Connect
A special thank you to Cocoa Ding, ArcGIS Support Consultant/ArcGIS Support Services for co-authoring this blog post.