Select to view content in your preferred language

center URL Parameter in Survey123 Web App Not Working

442
2
Jump to solution
12-15-2023 07:06 AM
bbaker_tngeo
New Contributor III

I have previously created workflows where URL parameters are passed from a popup link (in web map or Field Maps) and launches Survey123 field app, pulling information like coordinates, address, and business name. Perhaps something has changed recently or I am missing a step, but I am trying to create a similar workflow in the Survey123 Web App and the center parameter is not centering the geopoint question. 

I have seen other posts about using URL Encode to format the text before constructing the URL, which I have done. The coordinates (derived from 2 Arcade expressions in the popup) are being passed correctly but the geopoint question is not centering on the coordinates. Is this expected behavior for the Survey123 web app or have I missed something else? I also saw a mention of making the geopoint question required, but that has not remedied the situation either.

 

Expression:

 

 

//Latitude
var y = Centroid($feature).y
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lat = (y / originShift) * 180.0

lat = Round(180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0), 6)

//Longitude
var x = Centroid($feature).x
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = Round((x / originShift) * 180.0, 6)

var coordinate = lat + "," + lon
var business =  $feature.PLACENAME
var urlsource =  "https://survey123.arcgis.com/share/db33d329a1a1496da93e18f2d3eff601?"

var params = {
  center: coordinate,
  "field:busname": business,
}

return urlsource + UrlEncode(params)

 

 

Returns:

bbaker_tngeo_0-1702652602858.png

URL and Geopoint question center don't match:

bbaker_tngeo_1-1702652717971.png

 

 

1 Solution

Accepted Solutions
abureaux
MVP Regular Contributor

Took forever to find where I did this...

For the geopoint, set default to null

EDIT: I don't have required set for my geopoint, but I have seen others say that it may help.

View solution in original post

0 Kudos
2 Replies
abureaux
MVP Regular Contributor

Took forever to find where I did this...

For the geopoint, set default to null

EDIT: I don't have required set for my geopoint, but I have seen others say that it may help.

0 Kudos
bbaker_tngeo
New Contributor III

That solved it, thanks for the advice!

0 Kudos