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

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

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.

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

Parameters

LabelExplanationData Type
Input Features

The feature layer with a field that will be updated with geometry calculations.

Feature Layer
Geometry Attributes

Specifies the fields in which the selected geometry properties will be calculated.

You can select an existing field or provide a new field name. If a new field name is specified, the field type is determined by the type of values that are written to the field.

  • Count attributes are written to long integer fields.
  • Area, length, and x-, y-, z-, and m-coordinate attributes are written to double fields.
  • Coordinate notations such as Degrees Minutes Seconds or MGRS are written to text fields.

  • AREAThe area of each polygon feature.
  • AREA_GEODESICThe shape-preserving geodesic area of each polygon feature.
  • CENTROID_XThe centroid x-coordinate of each feature.
  • CENTROID_YThe centroid y-coordinate of each feature.
  • CENTROID_ZThe centroid z-coordinate of each feature.
  • CENTROID_MThe centroid m-coordinate of each feature.
  • INSIDE_XThe 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_YThe 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_ZThe 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_MThe 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_COUNTThe number of curves in each feature. Curves include elliptical arcs, circular arcs, and Bezier curves.
  • HOLE_COUNTThe number of interior holes within each polygon feature.
  • EXTENT_MIN_XThe minimum x-coordinate of each feature's extent.
  • EXTENT_MIN_YThe minimum y-coordinate of each feature's extent.
  • EXTENT_MIN_ZThe minimum z-coordinate of each feature's extent.
  • EXTENT_MAX_XThe maximum x-coordinate of each feature's extent.
  • EXTENT_MAX_YThe maximum y-coordinate of each feature's extent.
  • EXTENT_MAX_ZThe maximum z-coordinate of each feature's extent.
  • LENGTHThe length of each line feature.
  • LENGTH_GEODESICThe shape-preserving geodesic length of each line feature.
  • LENGTH_3DThe 3D length of each line feature.
  • LINE_BEARINGThe 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_XThe x-coordinate of the start point of each line feature.
  • LINE_START_YThe y-coordinate of the start point of each line feature.
  • LINE_START_ZThe z-coordinate of the start point of each line feature.
  • LINE_START_MThe m-coordinate of the start point of each line feature.
  • LINE_END_XThe x-coordinate of the end point of each line feature.
  • LINE_END_YThe y-coordinate of the end point of each line feature.
  • LINE_END_ZThe z-coordinate of the end point of each line feature.
  • LINE_END_MThe m-coordinate of the end point of each line feature.
  • PART_COUNTThe number of parts composing each feature.
  • PERIMETER_LENGTHThe length of the perimeter or border of each polygon feature.
  • PERIMETER_LENGTH_GEODESICThe shape-preserving geodesic length of the perimeter or border of each polygon feature.
  • POINT_COUNTThe number of points or vertices composing each feature.
  • POINT_XThe x-coordinate of each point feature.
  • POINT_YThe y-coordinate of each point feature.
  • POINT_ZThe z-coordinate of each point feature.
  • POINT_MThe m-coordinate of each point feature.
  • POINT_COORD_NOTATIONThe x- and y-coordinate of each point feature formatted as a specified coordinate notation.
Value Table
Length Unit
(Optional)

Specifies the unit that will be used to calculate length.

  • Feet (United States) —The length unit will be feet (United States).
  • Meters —The length unit will be meters.
  • Kilometers —The length unit will be kilometers.
  • Miles (United States) —The length unit will be miles (United States).
  • Nautical miles (United States) —The length unit will be nautical miles (United States).
  • Yards (United States) —The length unit will be yards (United States).
String
Area Unit
(Optional)

Specifies the unit that will be used to calculate area.

  • Acres —The area unit will be acres.
  • Hectares —The area unit will be hectares.
  • Square miles (United States) —The area unit will be square miles (United States).
  • Square kilometers —The area unit will be square kilometers.
  • Square meters —The area unit will be square meters.
  • Square feet (United States) —The area unit will be square feet (United States).
  • Square yards (United States) —The area unit will be square yards (United States).
  • Square nautical miles (United States) —The area unit will be 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.

For coordinate-based geometry properties, the coordinate system will only be applied when the coordinate format is the same as input; otherwise, the geographic coordinate system WGS84 will be used.

Coordinate System
Coordinate Format
(Optional)

Specifies the coordinate format in which the x- and y-coordinates will be calculated. The coordinate format matching the input features' spatial reference units is used by default.

  • Same as input —The input features' spatial reference units will be used for coordinate formatting. This is the default.
  • Decimal Degrees —Decimal Degrees.
  • Degrees Minutes Seconds (DDD° MM' SSS.ss" <N|S|E|W>) —Degrees Minutes Seconds with cardinal direction component at the end (DDD° MM' SSS.ss" <N|S|E|W>).
  • Degrees Minutes Seconds (<N|S|E|W> DDD° MM' SSS.ss") —Degrees Minutes Seconds with cardinal direction component at the beginning (<N|S|E|W> DDD° MM' SSS.ss").
  • Degrees Minutes Seconds (<+|-> DDD° MM' SSS.ss") —Degrees Minutes Seconds with positive or negative direction component at the beginning (<+|-> DDD° MM' SSS.ss").
  • Degrees Minutes Seconds (<+|-> DDD.MMSSSss) —Degrees Minutes Seconds packed into a single value with positive or negative direction component at the beginning (<+|-> DDD.MMSSSss).
  • Degrees Decimal Minutes (DDD° MM.mmm' <N|S|E|W>) —Degrees Decimal Minutes with cardinal direction component at the end (DDD° MM.mmm' <N|S|E|W>).
  • Degrees Decimal Minutes (<N|S|E|W> DDD° MM.mmm') —Degrees Decimal Minutes with cardinal direction component at the beginning (<N|S|E|W> DDD° MM.mmm').
  • Degrees Decimal Minutes (<+|-> DDD° MM.mmm') —Degrees Decimal Minutes with positive or negative direction component at the beginning (<+|-> DDD° MM.mmm').
  • GARS (Global Area Reference System) —The Global Area Reference System is based on latitude and longitude, dividing and subdividing the world into cells.
  • GEOREF (World Geographic Reference System) —The World Geographic Reference System is based on the geographic system of latitude and longitude, but using a simpler and more flexible notation.
  • MGRS (Military Grid Reference System) —Military Grid Reference System.
  • USNG (United States National Grid) —United States National Grid.
  • UTM (Universal Transverse Mercator) —Universal Transverse Mercator.
  • UTM with no spaces —Universal Transverse Mercator with no spaces.
String

Derived Output

LabelExplanationData Type
Updated Features

The updated input features.

Feature Layer

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

The feature layer with a field that will be updated with geometry calculations.

Feature Layer
geometry_property
[[Field, Property],...]

Specifies the fields in which the selected geometry properties will be calculated.

You can select an existing field or provide a new field name. If a new field name is specified, the field type is determined by the type of values that are written to the field.

  • Count attributes are written to long integer fields.
  • Area, length, and x-, y-, z-, and m-coordinate attributes are written to double fields.
  • Coordinate notations such as Degrees Minutes Seconds or MGRS are written to text fields.

  • AREAThe area of each polygon feature.
  • AREA_GEODESICThe shape-preserving geodesic area of each polygon feature.
  • CENTROID_XThe centroid x-coordinate of each feature.
  • CENTROID_YThe centroid y-coordinate of each feature.
  • CENTROID_ZThe centroid z-coordinate of each feature.
  • CENTROID_MThe centroid m-coordinate of each feature.
  • INSIDE_XThe 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_YThe 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_ZThe 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_MThe 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_COUNTThe number of curves in each feature. Curves include elliptical arcs, circular arcs, and Bezier curves.
  • HOLE_COUNTThe number of interior holes within each polygon feature.
  • EXTENT_MIN_XThe minimum x-coordinate of each feature's extent.
  • EXTENT_MIN_YThe minimum y-coordinate of each feature's extent.
  • EXTENT_MIN_ZThe minimum z-coordinate of each feature's extent.
  • EXTENT_MAX_XThe maximum x-coordinate of each feature's extent.
  • EXTENT_MAX_YThe maximum y-coordinate of each feature's extent.
  • EXTENT_MAX_ZThe maximum z-coordinate of each feature's extent.
  • LENGTHThe length of each line feature.
  • LENGTH_GEODESICThe shape-preserving geodesic length of each line feature.
  • LENGTH_3DThe 3D length of each line feature.
  • LINE_BEARINGThe 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_XThe x-coordinate of the start point of each line feature.
  • LINE_START_YThe y-coordinate of the start point of each line feature.
  • LINE_START_ZThe z-coordinate of the start point of each line feature.
  • LINE_START_MThe m-coordinate of the start point of each line feature.
  • LINE_END_XThe x-coordinate of the end point of each line feature.
  • LINE_END_YThe y-coordinate of the end point of each line feature.
  • LINE_END_ZThe z-coordinate of the end point of each line feature.
  • LINE_END_MThe m-coordinate of the end point of each line feature.
  • PART_COUNTThe number of parts composing each feature.
  • PERIMETER_LENGTHThe length of the perimeter or border of each polygon feature.
  • PERIMETER_LENGTH_GEODESICThe shape-preserving geodesic length of the perimeter or border of each polygon feature.
  • POINT_COUNTThe number of points or vertices composing each feature.
  • POINT_XThe x-coordinate of each point feature.
  • POINT_YThe y-coordinate of each point feature.
  • POINT_ZThe z-coordinate of each point feature.
  • POINT_MThe m-coordinate of each point feature.
  • POINT_COORD_NOTATIONThe x- and y-coordinate of each point feature formatted as a specified coordinate notation.
Value Table
length_unit
(Optional)

Specifies the unit that will be used to calculate length.

  • FEET_USThe length unit will be feet (United States).
  • METERSThe length unit will be meters.
  • KILOMETERSThe length unit will be kilometers.
  • MILES_USThe length unit will be miles (United States).
  • NAUTICAL_MILESThe length unit will be nautical miles (United States).
  • YARDSThe length unit will be yards (United States).
String
area_unit
(Optional)

Specifies the unit that will be used to calculate area.

  • ACRESThe area unit will be acres.
  • HECTARESThe area unit will be hectares.
  • SQUARE_MILES_USThe area unit will be square miles (United States).
  • SQUARE_KILOMETERSThe area unit will be square kilometers.
  • SQUARE_METERSThe area unit will be square meters.
  • SQUARE_FEET_USThe area unit will be square feet (United States).
  • SQUARE_YARDSThe area unit will be square yards (United States).
  • SQUARE_NAUTICAL_MILESThe area unit will be 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.

For coordinate-based geometry properties, the coordinate system will only be applied when the coordinate format is the same as input; otherwise, the geographic coordinate system WGS84 will be used.

Coordinate System
coordinate_format
(Optional)

Specifies the coordinate format in which the x- and y-coordinates will be calculated. The coordinate format matching the input features' spatial reference units is used by default.

Several coordinate formats, including Degrees Minutes Seconds, Degrees Decimal Minutes, and others, require the calculation to be performed in a text field.

  • SAME_AS_INPUTThe input features' spatial reference units will be used for coordinate formatting. This is the default.
  • DDDecimal Degrees.
  • DMS_DIR_LASTDegrees Minutes Seconds with cardinal direction component at the end (DDD° MM' SSS.ss" <N|S|E|W>).
  • DMS_DIR_FIRSTDegrees Minutes Seconds with cardinal direction component at the beginning (<N|S|E|W> DDD° MM' SSS.ss").
  • DMS_POS_NEGDegrees Minutes Seconds with positive or negative direction component at the beginning (<+|-> DDD° MM' SSS.ss").
  • DMS_PACKEDDegrees Minutes Seconds packed into a single value with positive or negative direction component at the beginning (<+|-> DDD.MMSSSss).
  • DDM_DIR_LASTDegrees Decimal Minutes with cardinal direction component at the end (DDD° MM.mmm' <N|S|E|W>).
  • DDM_DIR_FIRSTDegrees Decimal Minutes with cardinal direction component at the beginning (<N|S|E|W> DDD° MM.mmm').
  • DDM_POS_NEGDegrees Decimal Minutes with positive or negative direction component at the beginning (<+|-> DDD° MM.mmm').
  • GARSThe Global Area Reference System is based on latitude and longitude, dividing and subdividing the world into cells.
  • GEOREFThe World Geographic Reference System is based on the geographic system of latitude and longitude, but using a simpler and more flexible notation.
  • MGRSMilitary Grid Reference System.
  • USNGUnited States National Grid.
  • UTMUniversal Transverse Mercator.
  • UTMNSUniversal Transverse Mercator with no spaces.
String

Derived Output

NameExplanationData 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.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"]])

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics