[GIS] Getting AttributeError: ‘module’ object has no attribute ‘CalculateGeometryAttributes_management’

arcpyattributeerror

I am trying to calculate the area for my grid cells. For that, I give the
following command

arcpy.CalculateGeometryAttributes_management(union, "AREA")

Here, union is my grid and I need to make a new field to store the area. I am getting the following error:

'module' object has no attribute 'CalculateGeometryAttributes_management'

Best Answer

Prior to ArcGIS 10.6 to add and calculate an area you add the field with arcpy.AddField_management, type of float or double then use arcpy.CalculateField_management with the geometry attributes. See examples here.

The workflow looks like this:

arcpy.AddField_management(Union,'AREA','DOUBLE')
arcpy.CalculateField_management(Union,'AREA','!shape.area!','PYTHON')

As near as I can tell the 10.6 CalculateGeometryAttributes is a shortcut to executing the two instructions required in previous versions.

Related Question