Reverse Geocode from geoshape

07-09-2020 06:43 PM
Occasional Contributor II

I am hoping that someone has a bright idea here, because I am out of them.

I have a Collector/Explorer app with a link on the pop up for the Parcel Layer, that parses the boundary coordinates to a geoshape question in Survey123 .. that bit works great.

What I want to do is in Survey123 is perform a reverse geocode on the Geoshape to get the street address.  It would appear, obviously, that the pulldata("@geoshape",${location},"reverseGeocode.address.Street","https://xxxxxxxx/server/rest/services/Locators/xxxxxxx/GeocodeServer") calculation doesn't work for a geoshape question.

So I came up with a solution to add a geopoint question inside a repeat (because you cant have a geoshape and geopoint in the same form unless one is in a repeat) and use that to reverse geocode on. Now that works in the form itself, so tick!.

Then I thought I could calculate XY centroid of the poly in Collector using Arcade, tick, then parse that to the geopoint question.  HOWEVER, I have since found out that parsing information from Collector to Survey123 to questions inside a repeat isn't supported. 

Anyone have any solutions?  Any help would be greatly appreciated!

0 Kudos
1 Reply
Occasional Contributor II

I think I cracked it!

For those that are interested:

I added two lat and long  hidden null fields outside the Repeat in the survey. 

Then in the geopoint question added a concat calculation 'concat(${latitude}," ", ${longitude})' using  those two fields.

I then just use 

pulldata("@geopoint",${location},"reverseGeocode.address.Street","https://xxxxxxxx/server/rest/services/Locators/xxxxxxx/GeocodeServer to grab the street address

In the launch url I parse the poly centroid xy to the hidden lat and long fields in the Survey form and a geopoint is created at the centre of the polygon and the address is populated.

Happy Days!