I have a Python script that adds two fields and populates them with the X coordinate and Y coordinate of the centroid of the features. The feature class is in one projection, but I would like the centroid coordinates to be displayed in Lat/Lon. Is there a way to specify the coordinate system when you write something like !Shape.centroid!I know when you right click on a field in the attribute table and select "Calculate Geometry" that you have the option to use the Data Frame's coordinate system. Is there a way to do this programmatically?I've tried this function call and definition:
Lat(!Shape!)
def Lat(shape):
arcpy.env.cartographicCoordinateSystem = "Coordinate Systems\Geographic Coordinate\Systems\World\WGS 1984.prj"
lat = shape.centroid.x
return lat
but it returns the x coordinate in the the same projection of the feature class rather than longitude.