Can Centroid($feature) be used to populate lat/lon with attribute rule?

613
6
Jump to solution
01-16-2020 12:06 PM
ThomasColson
MVP Frequent Contributor

I see Geometry Functions | ArcGIS for Developers  exists but how would one call that to populate separate lat and lon fields with an attribute rule? 

0 Kudos
1 Solution

Accepted Solutions
KellyKoenig
Occasional Contributor

You can access the lat/long individually by adding ".X" or ".Y" to the end of Geometry($feature), so your attribute rule would be:

return Geometry($feature).Y

for Latitude, and 

return Geometry($feature).X

for Longitude. 

Arcade expression for Latitude

View solution in original post

6 Replies
KellyKoenig
Occasional Contributor

You can access the lat/long individually by adding ".X" or ".Y" to the end of Geometry($feature), so your attribute rule would be:

return Geometry($feature).Y

for Latitude, and 

return Geometry($feature).X

for Longitude. 

Arcade expression for Latitude

ThomasColson
MVP Frequent Contributor

Attribute rules are so cool.

KellyKoenig
Occasional Contributor

Totally agree. They're like magic!

DezsoLovicsek
New Contributor III

Is there a way to return the geometry in a different coordinate system? For example, my layer is in NAD83 but I would like for the WGS 84 coordinates to auto-populate in the attribute table.

AnneSantaMaria
New Contributor III

Has anyone been able to figure out if it is possible to populate an x,y or for that matter any geometry field (extents for example) in a coordinate system other than the one the feature class is project in?

0 Kudos
RebeccaBasquez1
New Contributor II

Hello Kelly,

I'm trying to use this expression in ArcPro 2.9.1 and I get an error. See attached. What am I doing wrong? Any help would be greatly appreciated.

0 Kudos