Is it possible to calculate points XY coordinates in Decimal Degrees in model or script when a feature class is in projected coordinate system?
It's easy when a FC is in geographic coordinate system:
- using Add XY Coordinates tool or
- using Python expression eg.
!shape.extent.XMax!
I've found that area and length properties of geometry field can be modified with geometry unit conversion keyword. For linear units of measue one can use @DECIMALDEGREES.
Unfortunatelly, !shape.extent.XMax@decimaldegrees!
doesn't work as XMax is not a length.
In Calculate Geometry function (accessed from right-click) there's a possibility to choose Decimal Degrees output type even for projected feature class.
Can I do this using ArcPy?
Here's a code snippet based on iRfAn's solution:
import arcpy, os
projectedFC = r"C:\tmp\test.gdb\points01_Projected"
prjFile = os.path.join(arcpy.GetInstallInfo()["InstallDir"],
r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj")
spatialRef = arcpy.SpatialReference(prjFile)
updCursor = arcpy.UpdateCursor(projectedFC,"", spatialRef)
for row in updCursor:
pnt = row.Shape.getPart(0)
row.X = pnt.X
row.Y = pnt.Y
updCursor.updateRow(row)
del updCursor, row