Hello all, I was very excited to see this update that Collector supports Arcade expressions. I am trying to pass the existing feature service coordinates to the survey feature service layer using this article How To: Launch and populate a Survey123 for ArcGIS survey from Collector for ArcGIS using XY coordinates and attributes …
I still pass the Facility ID value through the popup which works
arcgis-survey123://?itemID=82f592fb0cf2454f93a757705b3d50dc&field:FacilityID={FACILITYID}{expression/expr0}
but the location won't pass to my survey with this arcade expression implemented on AGOL feature layer: (it works during the "test" button but does not pass the values.
function MetersToLatLon(x, y) {
// Converts XY point from Spherical Mercator EPSG:3857(Web Mercator Auxiliary Sphere) to lat/lon in WGS84 Datum (EPSG:4326).
// Source: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (x / originShift) * 180.0;
var lat = (y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return [lat, lon];
}
function CreateURLSurvey(lat, lon) {
var url = "¢er=" + lat + "," + lon;// This is the line that defines the location
Console(url);
return url;
}
var latlon = MetersToLatLon(Geometry($feature).X, Geometry($feature).Y);
var url = CreateURLSurvey(latlon[0], latlon[1]);
return url;
Furthermore, do I need a geopoint field in the survey? (I've tried both and still no success, unless there's something specific in calculcation or something I am missing).
Thank you all!