Select to view content in your preferred language

How to get an attribute rule to calculate XY in Decimal degrees rather than the local coordinate units.

630
6
05-23-2024 02:54 PM
MatthewBeal
Occasional Contributor III

I want to have our address point automatically calculate the XY coordinates in decimal degrees whenever a new address point is created. The problem I am running into is that when I use the Geometry($feature).x/y function, it creates the point in the map coordinate system units, which is feet. Is there any way to force it to use decimal degrees?

0 Kudos
6 Replies
HollyTorpey_LSA
Occasional Contributor III

I haven't done it for an attribute rule, but when I need a smart form to calculate latitude and longitude to populate a field, I use the script example included in this blog post: Common calculated expressions for ArcGIS Field Maps (esri.com). Scroll down to the "5. Store the geometry as an attribute" section and look at the second code block. Hope that helps!

- Holly
MatthewBeal
Occasional Contributor III

This is what I'm going for except for the fact that it is in meters rather than feet. Although I guess I can insert a line converting the ft to meters. I will experiment with this and report back. 

0 Kudos
MatthewBeal
Occasional Contributor III

No matter what I do, I can't get this to work. Our data is in us feet. I cannot figure out a way to get that into meters so that it works with this script. 

0 Kudos
HollyTorpey_LSA
Occasional Contributor III

Is your data projected? If so, take a look at the response from @RandyBurton in this post: https://community.esri.com/t5/python-questions/feet-to-decimal-degrees-function/td-p/289896

- Holly
0 Kudos
MatthewBeal
Occasional Contributor III

That's a python script though, right? You can't apply that as an on the fly attribute rule, unless there is a way I am unaware of. 

0 Kudos
HollyTorpey_LSA
Occasional Contributor III

Yeah, true. I was thinking more that the workflow could be useful (not the specific code), but I guess it's not since there's no analagous function in Arcade yet (https://community.esri.com/t5/arcgis-pro-ideas/arcade-projectas-geometry-function/idi-p/1171382#comm...). 😞

In the meantime, maybe the Arcade code shared by @TomNeer on page two of that thread will work for you (if you are in a State Plane zone that uses Lambert conformal conic projection). If you're in a zone that uses transverse Mercator, I'm out of ideas other than upvoting that idea linked above.

- Holly
0 Kudos