Hi. In ArcGIS Online using the web map Attribute Expressions builder, I'm trying to pull feature xy coordinates to show in a popup. In the builder, my code successfully tests with a value; but the value in the popup and layer table is empty. I'm using a map service if that matters.
So, is this code supposed to work? Or am I doing something wrong?
Thanks.
Hello Xander:
Thank you for posting this! I am wondering why my conversions are not lining up with my coordinates calculated in Arcmap. Is this the limit of this method as it is already less than 1 metre or do i need to set my Origin Shift differently perhaps?
X Conversion:
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (Geometry($feature).x / originShift) * 180.0;
return [lon];
Y Conversion:
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lat = (Geometry($feature).y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
return [lat];
Kind Regards
The arcade expression to calculate the lat/lon values is not the most precise way of calculating the data. In addition depending on the view scale Arcade might not retrieve the exact location from the feature. The precision will do to launch navigation with Waze or open a window with Streetview, but is not the solution for an exact conversion of the coordinates. I am still waiting for the projection engine to be implemented in Arcade to obtain more exact results.
Hopefully there will be a blog post when the projection engine comes to Arcade.
Is there a way to display the location of a point in pop up using the arcade or any other way to add location in pop up along with other attributes that i get from arcade expression??
Yes, you can. You can access the coordinate properties of a geometry and include those in the pop-up using Arcade. See example below:
var geom = Geometry($feature);
return "(" + Round(geom.x, 3) + ", " + Round(geom.y, 3) + ")";
i am trying to say i want to include the address of a point in a pop up using arcade(something like reverse geocode to get the address of a point as it is displayed in google map)!! i have a point layer which is editable by the user. When user adds a point i want address be displayed in the popup along with other attribute.
Reverse geocoding is not available through Arcade.
Hi Xander Bakker, Is possible do the transformation of LatLong to UTM coordinates? Or There is any code in arcade that show coordinates in UTM directly?
Best regards.
Braulio.
Hi/Hola Braulio Galvez ,
At this moment, only if you have a formula that allows to calculate the coordinates that you want, this is possible. As shown in the examples I shared above: https://community.esri.com/thread/199141-arcade-expression-for-geometry-in-arcgis-online-popup#comme...
Hopefully, in the near future there will be support for a transformation engine, or what I have heard, being able to make web requests in Arcade to do this transformation using a REST call and interpret the result. This last feature is something that is on the roadmap, but I don not know the ETA.