where to adjust unit in the python code for calculate geometry

Discussion created by helenak on Apr 29, 2012
Latest reply on Apr 30, 2012 by curtvprice

I used calculate geometry to get X and Y coordinates for point shapefiles.
However, the unit is in meters. (Behrmann)
Please kindly advise if any method available in python to adjust the unit to decimal degree of longitude and latitude.

(ArcGIS 9.3 and pythonwin 2.5)


# Calculate x and y centroid fields using the geometry property Centroid (by David Wynne)
import arcgisscripting, sys
gp = arcgisscripting.create()

inputfc = sys.argv[1]

gp.AddField_management(inputfc, "xCentroid", "DOUBLE", 18, 11)
gp.AddField_management(inputfc, "yCentroid", "DOUBLE", 18, 11)

# Centroid property returns a string with x and y separated by a space
xExpression = "float(!SHAPE.CENTROID!.split()[0])"
yExpression = "float(!SHAPE.CENTROID!.split()[1])"

gp.CalculateField_management(inputfc, "xCentroid", xExpression, "PYTHON")
gp.CalculateField_management(inputfc, "yCentroid", yExpression, "PYTHON")