Hello
I have written a script and within it I try to calculate coordinate values based on WGS 1984 GCS. I wrote the below line:
arcpy.management.CalculateGeometryAttributes(points_name, ['Y', 'POINT_Y'], coordinate_system='WGS1984')
However, the name of the coordinate system is causing an error. Any suggestion what should the name be?
Solved! Go to Solution.
You probably need to use the WKID (Well Known ID) which for WGS 1984 GCS is 4326.
You probably need to use the WKID (Well Known ID) which for WGS 1984 GCS is 4326.
This is one of the times I find the UI helpful. Fire up pro, do the operation manually, open up the analysis tools history, copy the the function as a python snippet, paste that somewhere, copy out the correct string for the coordinate system, put that into your code.
Another option is if the script touches a feature layer with the desired coordinate system, the script can query out the coordinate system value, stash that into a variable and use the variable in the calculategeometry operation.
Maybe add the space between WGS and 1984. 'WGS 1984'
edited to add using the spatial reference object since the docs do not show it and the method might not cast it from the 'WGS 1984' string:
sr = arcpy.SpatialReference('WGS 1984')
arcpy.management.CalculateGeometryAttributes(points_name, ['Y', 'POINT_Y'], coordinate_system=sr)