Skip to main content

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

  1. Add an Address question to your survey (Question name: Address) 

  1. Add a Singleline text question to your survey (Question name: Dog off-leash Parks). 

  1. Select the Singleline text question, under the Edit tab, click the edit button next to Calculation. 

A text field labeled 'Calculation' with the placeholder text 'Use an expression to calculate the answer,' and an 'Edit' link on the top right. 

 Setting up a calculation field in survey123 form

  1. 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. 

 Interface for extracting data, with options to select the source as 'Layer,' 'Question,' or 'Survey.' A layer named 'dog_off_leash_parks' is selected, and the output field is set to 'name.’  

Configuring data extraction from a specific layer to retrieve the desired output field 

  1. Toggle ON the Set filter and connect it to your Address_geopoint question. 

Filter settings with a toggle enabled for 'Extract data by location.' The dropdown menu is set to 'Address_geopoint.'  

Applying a location-based filter to extract data using specific attributes

6. Save your change and publish the survey. 

A Survey123 interactive web form titled 'Point-in-Polygon calculations' with fields for 'Address' and 'Dog Off Leash Parks.'  allowing users to input an address and view corresponding results for 'Dog Off Leash Parks.‘ 

The video demonstrates the outcome in Survey123 Web

In ArcGIS Survey123 Connect

  1. Start by creating a blank new survey in Survey123 Connect and open the XLSForm. 

  1. In the first row, set the question type to text for entering the address location. Under the appearance column, select geocode. 

 A screenshot of a spreadsheet with headers 'type,' 'name,' 'label,' 'guidance_hint,' and 'appearance.' The first row includes 'text' as type, 'address' as name, and 'Enter the Address' as label. 

Set up question for entering Address

  1. In the second row, add a geopoint question. Set the appearance to hidden so this field doesn’t appear in the survey. 

A screenshot of a spreadsheet with headers 'type,' 'name,' 'label,' 'guidance_hint,' and 'appearance.' The second row shows 'geopoint' as type, 'address_geopoint' as name, and 'Address_geopoint' as label. Cells in the 'appearance' column display 'hidden.'  

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. 

  1. In the third row, add a text question to display the result. 

A screenshot of a spreadsheet with headers 'type,' 'name,' 'label,' 'guidance_hint,' and 'appearance.' The third row shows 'text' as type, 'dog_off_leash_parks' as name, and 'Dog Off Leash Parks' as label.   

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. 

A spreadsheet highlighting the 'calculation' column, which contains formulas. One row features a formula to compute geopoint data by capturing latitude and longitude, while another includes a pulldata function to retrieve the location result.  

How the pull-data function works under Survey123 Connect XLS form 

5. Save your change and publish the survey.  

Survey123 Connect with fields for 'Enter the Address' and 'Dog Off Leash Parks.'  allowing users to input an address and view corresponding results for 'Dog Off Leash Parks 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.  

About the Author

Yalan Yang is an ArcGIS Support Analyst at Esri Canada, providing dedicated support for ArcGIS Online products. She assists customers with complex technical issues, troubleshoots product functionality and offers guidance to enhance the user experience. Yalan was introduced to GIS during her undergraduate studies in Urban Forestry at the University of British Columbia; she then obtained her Advanced Diploma in GIS from BCIT. Outside of work, she is a dessert lover and enjoys playing badminton.

Profile Photo of Yalan Yang