I have a feature class with x/y values populated on the native projection of the feature class (state plane).

In the same feature class I also have Lat/Long fields that I need to populate (WGS 84 in decimal degree).

The problem I have is the calculate geometry function doesn't allow me to choose a different projection other than State Plane when I try to auto populate the Lat/Long values.

Does anyone have any python code or ideas that might help with this request?

  • 1
    Add the data to ArcMap, set the data frame to WGS 84 (set a geographic transformation if needed!). Now try calculate geometry.
    – mkennedy
    Aug 19, 2015 at 20:06
  • Also asked on GeoNet
    – mkennedy
    Aug 19, 2015 at 20:07

2 Answers 2


you just need to run a cursor on it and use the projectAs() geometry method.

import arcpy

fc = r'C:\path_to\your_data\points.shp'

wgs = arcpy.SpatialReference(4326)
with arcpy.da.UpdateCursor(fc, ['SHAPE@', 'lat_field', 'long_field']) as rows:
    for row in rows:
        pnt_wgs = row[0].projectAs(wgs)
        row[1:] = [pnt_wgs.centroid.Y, pnt_wgs.centroid.X] #will be in decimal degrees
  • Thanks for your help cmackey...when I run that code I get an error as follows.....AttributeError: 'module' object has no attribute 'spatialReference'.....any ideas on that?
    – Nebula93
    Aug 20, 2015 at 18:38
  • Looks like you need to capitalize the S in SpatialReference. Python is a case sensitive language.
    – crmackey
    Aug 20, 2015 at 19:49

If you have access to ArcMap 10.2.1+, you can use Add Geometry Attributes, which allows you to specify a coordinate system.

spatref = arcpy.SpatialReference(4326) #WGS 84    
arcpy.AddGeometryAttributes_management(FC, "POINT_X_Y_Z_M", "FEET_US", "ACRES", spatref)

It's a script, not a tool, which means that you can inspect the code behind it to see what it does. It's similar to the answer posted by @crmackey, though it utilizes the spatial_reference parameter of UpdateCursor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.