## Summary

Adds information to a feature's attribute fields representing the spatial or geometric characteristics and location of each feature, such as length or area and x-, y-, z-, and m-coordinates.

A similar tool that adds multiple geometry attributes to new attribute fields is theAdd Geometry Attributes tool.

## Usage

If a coordinate system is specified, the length and area calculations will be in the units of that coordinate system unless different units are selected in the Length Unit and Area Unit parameters.

If the input features have a selection, only the selected features will have values calculated in the added fields; all other features will maintain their existing value.

This tool works with point, multipoint, polyline, and polygon feature classes.

## Syntax

CalculateGeometryAttributes_management (in_features, field, geometry_property, {length_unit}, {area_unit}, {coordinate_system})

Parameter | Explanation | Data Type |

in_features | The feature layer with a field that will be updated with geometry calculations. | Feature Layer |

field | The field that will be updated with geometry calculations. | Field |

geometry_property [[Target Field, Property],...] | Specifies the fields in which to calculate geometry properties and the geometry properties to calculate. The following are supported geometry properties: - AREA —The area of each polygon feature.
- AREA_GEODESIC —The shape-preserving geodesic area of each polygon feature.
- CENTROID_X —The centroid x-coordinate of each feature.
- CENTROID_Y —The centroid y-coordinate of each feature.
- CENTROID_Z —The centroid z-coordinate of each feature.
- CENTROID_M —The centroid m-coordinate of each feature.
- INSIDE_X —The x-coordinate of a central point inside or on each feature. This point is the same as the centroid if the centroid is inside the feature, otherwise it is an inner label point.
- INSIDE_Y —The y-coordinate of a central point inside or on each feature. This point is the same as the centroid if the centroid is inside the feature, otherwise it is an inner label point.
- INSIDE_Z —The z-coordinate of a central point inside or on each feature. This point is the same as the centroid if the centroid is inside the feature, otherwise it is an inner label point.
- INSIDE_M —The m-coordinate of a central point inside or on each feature. This point is the same as the centroid if the centroid is inside the feature, otherwise it is an inner label point.
- CURVE_COUNT —The number of curves in each feature. Curves include elliptical arcs, circular arcs, and Bezier curves.
- HOLE_COUNT —The number of interior holes within each polygon feature.
- EXTENT_MIN_X —The minimum x-coordinate of each feature's extent.
- EXTENT_MIN_Y —The minimum y-coordinate of each feature's extent.
- EXTENT_MIN_Z —The minimum z-coordinate of each feature's extent.
- EXTENT_MAX_X —The maximum x-coordinate of each feature's extent.
- EXTENT_MAX_Y —The maximum y-coordinate of each feature's extent.
- EXTENT_MAX_Z —The maximum z-coordinate of each feature's extent.
- LENGTH —The length of each line feature.
- LENGTH_GEODESIC —The shape-preserving geodesic length of each line feature.
- LENGTH_3D —The 3D length of each line feature.
- LINE_BEARING —The start-to-end bearing of each line feature. Values range from 0 to 360, with 0 meaning north, 90 east, 180 south, 270 west, and so on.
- LINE_START_X —The x-coordinate of the start point of each line feature.
- LINE_START_Y —The y-coordinate of the start point of each line feature.
- LINE_START_Z —The z-coordinate of the start point of each line feature.
- LINE_START_M —The m-coordinate of the start point of each line feature.
- LINE_END_X —The x-coordinate of the end point of each line feature.
- LINE_END_Y —The y-coordinate of the end point of each line feature.
- LINE_END_Z —The z-coordinate of the end point of each line feature.
- LINE_END_M —The m-coordinate of the end point of each line feature.
- PART_COUNT —The number of parts comprising each feature.
- PERIMETER_LENGTH —The length of the perimeter or border of each polygon feature.
- PERIMETER_LENGTH_GEODESIC —The shape-preserving geodesic length of the perimeter or border of each polygon feature.
- POINT_COUNT —The number of points or vertices comprising each feature.
- POINT_X —The x-coordinate of each point feature.
- POINT_Y —The y-coordinate of each point feature.
- POINT_Z —The z-coordinate of each point feature.
- POINT_M —The m-coordinate of each point feature.
| Value Table |

length_unit (Optional) | The unit used to calculate length. - FEET_US —Length in feet (United States)
- METERS —Length in meters
- KILOMETERS —Length in kilometers
- MILES_US —Length in miles (United States)
- NAUTICAL_MILES —Length in nautical miles (United States)
- YARDS —Length in yards (United States)
| String |

area_unit (Optional) | The unit used to calculate area. - ACRES —Area in acres
- HECTARES —Area in hectares
- SQUARE_MILES_US —Area in square miles (United States)
- SQUARE_KILOMETERS —Area in square kilometers
- SQUARE_METERS —Area in square meters
- SQUARE_FEET_US —Area in square feet (United States)
- SQUARE_YARDS —Area in square yards (United States)
- SQUARE_NAUTICAL_MILES —Area in square nautical miles (United States)
| String |

coordinate_system (Optional) | The coordinate system in which the coordinates, length, and area will be calculated. The coordinate system of the input features is used by default. | Coordinate System |

### Derived Output

Name | Explanation | Data Type |

updated_features |

## Code sample

##### CalculateGeometryAttributes example (Python window)

The following Python window script demonstrates how to use the CalculateGeometryAttributes tool.

```
import arcpy
arcpy.env.workspace = r"C:\data\City.gdb"
arcpy.CalculateGeometryAttributes_management("roads", [["Length_mi", "LENGTH"], ["Stops", "POINT_COUNT"]], "MILES_US")
```

##### CalculateGeometryAttributes example (stand-alone script)

Get the extent rectangle of each feature.

```
# Name: ExtentCreation.py
# import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = r"C:\data\City.gdb"
arcpy.env.outputCoordinateSystem = arcpy.Describe("roads").spatialReference
# Set local variables
in_features = "roads"
# Generate the extent coordinates using CalculateGeometry
arcpy.CalculateGeometryAttributes_management(in_features, [["Left", "EXTENT_MIN_X"],
["Bottom", "EXTENT_MIN_Y"],
["Right", "EXTENT_MAX_X"],
["Top", "EXTENT_MAX_Y"]])
```