Select to view content in your preferred language

Pass geocoder address from web app to Survey123

869
5
08-02-2023 09:35 AM
Elizabeth_Burniston
Regular Contributor

I have a web app in which a geocoding service is used. An address is searched, selected, and the associated polygon’s pop-up appears with a link to a survey. I would like the address to prepopulate the survey in a text field, as well as the geopoint to auto-zoom to that address as well. I don’t know how to pass data to a survey that does not already exist in a feature layer. Thanks for your help!

5 Replies
BarbaraWebster1
Esri Regular Contributor

Hi @Elizabeth_Burniston,

Have you looked into passing the address text and geopoint coordinates with URL parameters? 

The Parameters for the web app section of the Survey123 documentation  and this blog have more details. 

- Barbara

0 Kudos
Elizabeth_Burniston
Regular Contributor

Thanks @BarbaraWebster1 - I have used URL parameters in the past and considered this here, but how do I pass data from a geocoding service to the S123 feature layer? I am not using an existing feature layer with the address text and coordinates already populated. Further, the 'center' parameter requires a known coordinate to be entered. What would be the syntax for coordinates that change for each new survey?

0 Kudos
BarbaraWebster1
Esri Regular Contributor

Hi @Elizabeth_Burniston,

If you were accessing the survey link in a feature layer pop-up you could use Arcade to calculate the coordinates and construct the survey URL. Perhaps you can try a similar approach for your survey link? 

BarbaraWebster1_0-1691095271241.png

Also, Survey123 supports geocode services, another possible approach would be for the user to search for the address from the survey instead of the map. 

- Barbara

0 Kudos
Elizabeth_Burniston
Regular Contributor

Thanks again @BarbaraWebster1 - I'm not accomplished with Arcade by any means, but I will use what you provided as a template to see what I can do. Meanwhile, it is an information lookup app, so searching for an address is required. If their address falls in a certain area, then they are led to the survey. While it may be redundant, they can certainly enter their address again (text field - geoshape appearance) and ideally, I can put in the calculation to auto-zoom the map where they are to digitize their own polygon. So, I did just that but the map did not auto-zoom. I did some research and it seems this has been a bug over the years?

0 Kudos
BarbaraWebster1
Esri Regular Contributor

@Elizabeth_Burniston Calculations and defaults would attempt to populate the geoshape geometry, so it would be expected that passing point coordinates to a geoshape question wouldn't do anything. The center URL parameter would be the best approach to centering the map dynamically. 

0 Kudos