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....
You can use an Data Access Update Cursor to reproject the spatial data and then use the SHAPE@XY or SHAPE@X and SHAPE@Y tokens to get the X,Y values and then update the new fields.
@JoeBorgione Thank you. Yes, i did that as the following. I posted but no one has answer.
https://community.esri.com/t5/geodatabase-questions/attribute-rule-x-and-y-coordinates-decimal-degrees/td-p/1057252
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.
Hello @JoeBorgione @JoshuaBixby @LanceCole
I would like to do this same result but for attribute rule. Please kindly advise. Thank you.
Joe,
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<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>outputCoordinateSystem <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SpatialReference<SPAN class="punctuation token">(</SPAN><SPAN class="number token">4326</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#WGS 84 </SPAN> arcpy<SPAN class="punctuation token">.</SPAN>env<SPAN class="punctuation token">.</SPAN>geographicTransformations <SPAN class="operator token">=</SPAN> <SPAN class="string token">"WGS_1984_(ITRF00)_To_NAD_1983"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>AddXY_management<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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.
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...
Lance Cole
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.
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']])<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
Where fc is my feature class and the two fields are named accordingly.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.