I was asked to modify an attribute table and add Lat/Long in WGS 1984. The original point data (valves) is projected in NAD 1983 StatePlane Virginia South FIPS 4502 (US Feet). The first part of the code seems to work fine converting a new output table in WGS 1984. The second half of the code I created two new fields for lat/long to show the converted coordinates. I get a error message, see attached jpg. The two new fields (lat and Long) are created but only have <Null> data. Any help help would be appreciated.
Thanks,
Greg
I'm not 100% sure about this, but I think the CENTROID_X and CENTROID_Y geometry properties might only be valid against polyline and polygon geometries. Point features don't really have centroids, POINT_X and POINT_Y should do what you need instead.
Attaching screenshots of code and errors, instead of putting the text of code and errors into the thread, will definitely reduce the number of people that will even bother to look at your question. If you are asking people for help, make it as easy as possible for them to know your issue.
Taking the error messages at face value, you need to pass POINT_X instead of CENTROID_X, POINT_Y instead of CENTROID_Y. Although the documentation is a bit unclear regarding centroids, since you are working with points it is much clearer to use POINT instead of CENTROID.
Yep that was it...it is always something simple. Point_X , Point_Y is what I needed. Thank you!
P.S. I'll cut paste the code in text next time, sorry about that.
You can get the coordinates in the output coordinate system that you want without projecting it first. Just specify it in the tool
Calculate Geometry Attributes (Data Management)—ArcGIS Pro | Documentation
you don't use the individual fields which show the original coordinate system x, y values
Good point, I'll make the changed. That first part was part of earlier solution, before I found the Calculate Geometry Attributes () in a google search.
If you want both geographic and projected coordinates, just run the tool twice changing the spatial reference to match the desired output