I got suckered into thinking Calculate Geometry Attributes available in 10.6.1 by believing the online help. This post set me straight: https://community.esri.com/message/820951-calculate-geometry-attributes-tool. And no, ESRI has not updated the online help
However, the question remains: is there a way to calculate the X and Y geometry values of a point? I have a point feature class that's in State Plane coordinates, and I've added Lat/Long fields that I can manually calculate into GCS NAD 83 decimal degrees. I'd like to perform this task in a stand alone script....
Solved! Go to Solution.
I knew there had to be a way. Thanks. The new tool has a funky syntax, but I got it figured out:
arcpy.env.outputCoordinateSystem = 4269 #GCS_North_American_1983
arcpy.CalculateGeometryAttributes_management(fc,[['Latitude','POINT_Y'],['Longitude','POINT_X']])
Where fc is my feature class and the two fields are named accordingly.
Are you looking to do this for a single point or all points in a feature class? If for a feature class you can use Add XY Coordinates. This will add or update the PointX and PointY fields to your feature class. To do this for a different coordinate system than that of the feature class you need to set the output coordinate system and transformation in the environment settings when running the tool. I use this all the time to add GCS decimal degrees to our state plane data for use in other applications. I will add a few screen shots once I can get on a desktop system later this evening.
Thanks Lance; this particular script is more or less for maintenance of the point feature class. The default coordinate system is State Plane NAD 83 feet; The two fields are added to the feature class since the field techs thin in Lat/Long, not feet. The points get edited (moved) from time to time, so I just want to re-calculate them on a regular basis. Looking at the Add XY Coordinates link you provide, the field names have to be Point_X and Point_Y; once it's run initially, it can be run as a maintenance item I presume...
You are correct AddXY uses or will add the Point_X and Point_Y attributes to your feature when run. We use this when pushing out data to AGOL to add X and Y attributes to be consumed by other applications such as Collector or Survey123 that need lat/long in WGS 1984 decimal degrees for example.
arcpy.env.outputCoordinateSystem = arcpy.SpatialReference(4326) #WGS 84
arcpy.env.geographicTransformations = "WGS_1984_(ITRF00)_To_NAD_1983"
arcpy.AddXY_management(fc)
One other side note, do not forget about the transformation for projecting coordinate systems in addition to the coordinate system. This can be added to your script using the arcpy.env.geographicTransforamtions.
Hello @JoeBorgione @JoshuaBixby @LanceCole
I would like to do this same result but for attribute rule. Please kindly advise. Thank you.
It appears that
Geometry($feature).x and
Geometry(#feature).y
Should return what you want.
A quick google search of 'arcgis arcade return coordinates' got me going.
@JoeBorgione Thank you. Yes, i did that as the following. I posted but no one has answer.