I have an arcade expression as follows in the add-ons of a polygon hosted feature layer on arcgis online:
var geom = Geometry($feature);
var firstpart = geom.rings[0];
var outparts = [];
var counter = 0;
function metersToLatLon(mx, my) {
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (firstpart[pt].x / originShift) * 180.0;
var lat = (firstpart[pt].y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan(Exp(lat * PI / 180.0)) - PI / 2.0);
return Concatenate(lat, " ", lon);
}
for (var pt in firstpart){
var ptstr = metersToLatLon(firstpart[pt].x, firstpart[pt].y);
outparts[counter]= ptstr;
counter = counter + 1;
}
return Concatenate(outparts, ";")
The expression works as intended when tested, however, when I try to view in the popup or attributes table, nothing appears. It also has not successfully saved in the layer. Ideas??
The goal of this workflow is to have a polygon shape passed through URL to a survey123 form geoshape question, hence the metersToLatLon function.