pulldata("@geopoint",${location},"reversegeocode.other_field

1621
1
10-21-2020 03:30 PM
JessicaRidout
New Contributor II

Hello. I built a form with Survey123 Connect that's using pulldata("@geopoint",${location},"reversegeocode.address.Match_addr","CustomLocatorURL") to fill in the address for a question automatically. Works great! What I can't figure out is how to use the same method to pull other information from a locator, like City Council District or Neighborhood. Is that possible? Is the Match_addr field the only field this can pull, or is there a way to make it pull another field, like City or State?

I've tried every locator style that uses polygon data, Single House, Zip, City State, Gazatteer, but it doesn't seem to work with area locators, only point or line. Is there another way to automatically fill in information about a point location from the geopoint question? 

Tags (2)
0 Kudos
1 Reply
IsmaelChivite
Esri Notable Contributor

Hi Jessica Ridout

The reversegeocode.address.Match_addr bit of the pulldata function refers to the output of your locator.  When using the Esri World Geocoding service, the output of the locator looks something like this:

{
        "address":{
               "Match_addr":"570 St Kilda Rd, Melbourne, Victoria, 3004",
               "LongLabel":"570 St Kilda Rd, Melbourne, Victoria, 3004, AUS",
               "ShortLabel":"570 St Kilda Rd",
               "Addr_type":"PointAddress",
               "Type":"",
               "PlaceName":"",
               "AddNum":"570",
               "Address":"570 St Kilda Rd",        "Block":"",
               "Sector":"",
               "Neighborhood":"Melbourne",
               "District":"",
               "City":"Melbourne",
               "MetroArea":"",
               "Subregion":"",
               "Region":"Victoria",
               "Territory":"",
               "Postal":"3004",
               "PostalExt":"",
               "CountryCode":"AUS"
               },
        "location":{
               "x":144.97914150000003,
               "y":-37.847384999999996,
               "spatialReference":{
                       "wkid":4326,
                       "latestWkid":4326
               }
        }
}

With a custom locator, the response will be different, so you need to adjust your pulldata function accordingly.

The easiest way to figure things out is to:

1- Create a text question in your survey. Set the esriFieldLength value in your XLSForm to a very high number such as 50000. Also set the esriFieldType to null so the JSON is never written into the feature layer.

2- In the calculation for this new text question add something like this:

pulldata("@geopoint",${location},"reversegeocode")

3- Now run your survey and look at the output JSON string you get.  Put the text into JSONLint - The JSON Validator  or some other JSON formatter utility.

4- Construct your new pulldata function accordingly and remove the question you added in step 1 if you no longer needed.

For reference, check https://community.esri.com/groups/survey123/blog/2018/07/06/understanding-reverse-geocoding-in-surve... if not already.