# Calculate Geometry Attributes (Data Management)

## 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-coordinates, and m-values.

## Usage

##### Caution:

This tool modifies the input data. See Tools that modify or update the input data for more information and strategies to avoid undesired data changes.

• Length and area calculations will be in the units of the input features' coordinate system unless different units are selected in the Length Unit and Area Unit parameters. If the Coordinate System parameter is specified, the length and area calculations will be in the units of that coordinate system unless different units are specified in the Length Unit and Area Unit parameters.

• The geodesic length and area properties use a shape-preserving algorithm. This produces highly accurate results that are not biased by an assumption that the input line or polygon features are constructed with geodesic arcs between the vertices, which is the assumption regarding traditional geodesic length and area.

• 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.

## Parameters

### Derived Output

 Label Explanation Data Type Updated Features The updated input features. Feature Layer

`arcpy.management.CalculateGeometryAttributes(in_features, geometry_property, {length_unit}, {area_unit}, {coordinate_system}, {coordinate_format})`

### Derived Output

 Name Explanation Data Type updated_features The updated input features. Feature Layer

### Code sample

CalculateGeometryAttributes example (Python window)

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

``````import arcpy
arcpy.env.workspace = r"C:\data\City.gdb"
arcpy.management.CalculateGeometryAttributes("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"

# Set local variables

# Generate the extent coordinates using CalculateGeometry
arcpy.management.CalculateGeometryAttributes(in_features, [["Left", "EXTENT_MIN_X"],
["Bottom", "EXTENT_MIN_Y"],
["Right", "EXTENT_MAX_X"],
["Top", "EXTENT_MAX_Y"]])``````

## Licensing information

• Basic: Yes
• Standard: Yes