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.

    Learn more about length and area units in geoprocessing tools

  • 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

LabelExplanationData Type
Input Features

The features with a field that will be updated with geometry calculations.

Feature Layer
Geometry Attributes

The fields in which the specified geometry properties will be calculated.

You can select an existing field or provide a new field name. If a new field name is provided, 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-coordinate, and m-value attributes are written to double fields; and coordinate notations such as Degrees Minutes Seconds or MGRS are written to text fields.

Unless otherwise noted, area and length properties are planar measurements using 2D Cartesian mathematics.

  • Area—An attribute will be added to store the area of each polygon feature.
  • Area (geodesic)—An attribute will be added to store the shape-preserving geodesic area of each polygon feature.
  • Centroid x-coordinate—An attribute will be added to store the centroid x-coordinate of each feature.
  • Centroid y-coordinate—An attribute will be added to store the centroid y-coordinate of each feature.
  • Centroid z-coordinate—An attribute will be added to store the centroid z-coordinate of each feature.
  • Centroid m-value—An attribute will be added to store the centroid m-value of each feature.
  • Central point x-coordinate—An attribute will be added to store 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.
  • Central point y-coordinate—An attribute will be added to store 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.
  • Central point z-coordinate—An attribute will be added to store 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.
  • Central point m-value—An attribute will be added to store the m-value 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.
  • Number of curves—An attribute will be added to store the number of curves in each feature. Curves include elliptical arcs, circular arcs, and Bezier curves.
  • Number of holes—An attribute will be added to store the number of interior holes within each polygon feature.
  • Minimum x-coordinate—An attribute will be added to store the minimum x-coordinate of each feature's extent.
  • Minimum y-coordinate—An attribute will be added to store the minimum y-coordinate of each feature's extent.
  • Minimum z-coordinate—An attribute will be added to store the minimum z-coordinate of each feature's extent.
  • Maximum x-coordinate—An attribute will be added to store the maximum x-coordinate of each feature's extent.
  • Maximum y-coordinate—An attribute will be added to store the maximum y-coordinate of each feature's extent.
  • Maximum z-coordinate—An attribute will be added to store the maximum z-coordinate of each feature's extent.
  • Length—An attribute will be added to store the length of each line feature.
  • Length (geodesic)—An attribute will be added to store the shape-preserving geodesic length of each line feature.
  • Length (3D)—An attribute will be added to store the 3D length of each line feature.
  • Line bearing—An attribute will be added to store 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-coordinate—An attribute will be added to store the x-coordinate of the start point of each line feature.
  • Line start y-coordinate—An attribute will be added to store the y-coordinate of the start point of each line feature.
  • Line start z-coordinate—An attribute will be added to store the z-coordinate of the start point of each line feature.
  • Line start m-value—An attribute will be added to store the m-value of the start point of each line feature.
  • Line end x-coordinate—An attribute will be added to store the x-coordinate of the end point of each line feature.
  • Line end y-coordinate—An attribute will be added to store the y-coordinate of the end point of each line feature.
  • Line end z-coordinate—An attribute will be added to store the z-coordinate of the end point of each line feature.
  • Line end m-value—An attribute will be added to store the m-value of the end point of each line feature.
  • Number of parts—An attribute will be added to store the number of parts composing each feature.
  • Number of vertices—An attribute will be added to store the number of points or vertices composing each feature.
  • Perimeter length—An attribute will be added to store the length of the perimeter or border of each polygon feature.
  • Perimeter length (geodesic)—An attribute will be added to store the shape-preserving geodesic length of the perimeter or border of each polygon feature.
  • Point x-coordinate—An attribute will be added to store the x-coordinate of each point feature.
  • Point y-coordinate—An attribute will be added to store the y-coordinate of each point feature.
  • Point z-coordinate—An attribute will be added to store the z-coordinate of each point feature.
  • Point m-value—An attribute will be added to store the m-value of each point feature.
  • Point x- and y-coordinate notation—An attribute will be added to store the 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.

  • KilometersThe length unit will be kilometers.
  • MetersThe length unit will be meters.
  • Statute MilesThe length unit will be statute miles.
  • International Nautical MilesThe length unit will be international nautical miles.
  • International YardsThe length unit will be international yards.
  • International FeetThe length unit will be international feet.
  • US Survey MilesThe length unit will be US survey miles.
  • US Survey Nautical MilesThe length unit will be US survey nautical miles.
  • US Survey YardsThe length unit will be US survey yards.
  • US Survey FeetThe length unit will be US survey feet.
String
Area Unit
(Optional)

Specifies the unit that will be used to calculate area.

  • Square KilometersThe area unit will be square kilometers.
  • HectaresThe area unit will be hectares.
  • Square MetersThe area unit will be square meters.
  • Square Statute MilesThe area unit will be square statute miles.
  • Square International Nautical MilesThe area unit will be square international nautical miles.
  • International AcresThe area unit will be international acres.
  • Square International YardsThe area unit will be square international yards.
  • Square International FeetThe area unit will be square international feet.
  • Square US Survey MilesThe area unit will be square US survey miles.
  • Square US Survey Nautical MilesThe area unit will be square US survey nautical miles.
  • US Survey AcresThe area unit will be US survey acres.
  • Square US Survey YardsThe area unit will be square US survey yards.
  • Square US Survey FeetThe area unit will be square US survey feet.
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
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.
  • Decimal DegreesThe coordinate format will be Decimal Degrees.
  • Degrees Minutes Seconds (DDD° MM' SSS.ss" <N|S|E|W>)The coordinate format will be 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")The coordinate format will be 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")The coordinate format will be Degrees Minutes Seconds with positive or negative direction component at the beginning (<+|-> DDD° MM' SSS.ss").
  • Degrees Minutes Seconds (<+|-> DDD.MMSSSss)The coordinate format will be 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>)The coordinate format will be 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')The coordinate format will be Degrees Decimal Minutes with cardinal direction component at the beginning (<N|S|E|W> DDD° MM.mmm').
  • Degrees Decimal Minutes (<+|-> DDD° MM.mmm')The coordinate format will be Degrees Decimal Minutes with positive or negative direction component at the beginning (<+|-> DDD° MM.mmm').
  • GARS (Global Area Reference System)The coordinate format will be 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 coordinate format will be 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)The coordinate format will be Military Grid Reference System.
  • USNG (United States National Grid)The coordinate format will be United States National Grid.
  • UTM (Universal Transverse Mercator)The coordinate format will be Universal Transverse Mercator.
  • UTM with no spacesThe coordinate format will be 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 features with a field that will be updated with geometry calculations.

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

The fields in which the specified geometry properties will be calculated.

You can select an existing field or provide a new field name. If a new field name is provided, 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-coordinate, and m-value attributes are written to double fields; and coordinate notations such as Degrees Minutes Seconds or MGRS are written to text fields.

Unless otherwise noted, area and length properties are planar measurements using 2D Cartesian mathematics.

  • AREA—An attribute will be added to store the area of each polygon feature.
  • AREA_GEODESIC—An attribute will be added to store the shape-preserving geodesic area of each polygon feature.
  • CENTROID_X—An attribute will be added to store the centroid x-coordinate of each feature.
  • CENTROID_Y—An attribute will be added to store the centroid y-coordinate of each feature.
  • CENTROID_Z—An attribute will be added to store the centroid z-coordinate of each feature.
  • CENTROID_M—An attribute will be added to store the centroid m-value of each feature.
  • INSIDE_X—An attribute will be added to store 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—An attribute will be added to store 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—An attribute will be added to store 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—An attribute will be added to store the m-value 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—An attribute will be added to store the number of curves in each feature. Curves include elliptical arcs, circular arcs, and Bezier curves.
  • HOLE_COUNT—An attribute will be added to store the number of interior holes within each polygon feature.
  • EXTENT_MIN_X—An attribute will be added to store the minimum x-coordinate of each feature's extent.
  • EXTENT_MIN_Y—An attribute will be added to store the minimum y-coordinate of each feature's extent.
  • EXTENT_MIN_Z—An attribute will be added to store the minimum z-coordinate of each feature's extent.
  • EXTENT_MAX_X—An attribute will be added to store the maximum x-coordinate of each feature's extent.
  • EXTENT_MAX_Y—An attribute will be added to store the maximum y-coordinate of each feature's extent.
  • EXTENT_MAX_Z—An attribute will be added to store the maximum z-coordinate of each feature's extent.
  • LENGTH—An attribute will be added to store the length of each line feature.
  • LENGTH_GEODESIC—An attribute will be added to store the shape-preserving geodesic length of each line feature.
  • LENGTH_3D—An attribute will be added to store the 3D length of each line feature.
  • LINE_BEARING—An attribute will be added to store 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—An attribute will be added to store the x-coordinate of the start point of each line feature.
  • LINE_START_Y—An attribute will be added to store the y-coordinate of the start point of each line feature.
  • LINE_START_Z—An attribute will be added to store the z-coordinate of the start point of each line feature.
  • LINE_START_M—An attribute will be added to store the m-value of the start point of each line feature.
  • LINE_END_X—An attribute will be added to store the x-coordinate of the end point of each line feature.
  • LINE_END_Y—An attribute will be added to store the y-coordinate of the end point of each line feature.
  • LINE_END_Z—An attribute will be added to store the z-coordinate of the end point of each line feature.
  • LINE_END_M—An attribute will be added to store the m-value of the end point of each line feature.
  • PART_COUNT—An attribute will be added to store the number of parts composing each feature.
  • POINT_COUNT—An attribute will be added to store the number of points or vertices composing each feature.
  • PERIMETER_LENGTH—An attribute will be added to store the length of the perimeter or border of each polygon feature.
  • PERIMETER_LENGTH_GEODESIC—An attribute will be added to store the shape-preserving geodesic length of the perimeter or border of each polygon feature.
  • POINT_X—An attribute will be added to store the x-coordinate of each point feature.
  • POINT_Y—An attribute will be added to store the y-coordinate of each point feature.
  • POINT_Z—An attribute will be added to store the z-coordinate of each point feature.
  • POINT_M—An attribute will be added to store the m-value of each point feature.
  • POINT_COORD_NOTATION—An attribute will be added to store the 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.

  • KILOMETERSThe length unit will be kilometers.
  • METERSThe length unit will be meters.
  • MILES_INTThe length unit will be statute miles.
  • NAUTICAL_MILES_INTThe length unit will be international nautical miles.
  • YARDS_INTThe length unit will be international yards.
  • FEET_INTThe length unit will be international feet.
  • MILES_USThe length unit will be US survey miles.
  • NAUTICAL_MILESThe length unit will be US survey nautical miles.
  • YARDSThe length unit will be US survey yards.
  • FEET_USThe length unit will be US survey feet.
String
area_unit
(Optional)

Specifies the unit that will be used to calculate area.

  • SQUARE_KILOMETERSThe area unit will be square kilometers.
  • HECTARESThe area unit will be hectares.
  • SQUARE_METERSThe area unit will be square meters.
  • SQUARE_MILES_INTThe area unit will be square statute miles.
  • SQUARE_NAUTICAL_MILESThe area unit will be square international nautical miles.
  • ACRESThe area unit will be international acres.
  • SQUARE_YARDSThe area unit will be square international yards.
  • SQUARE_FEET_INTThe area unit will be square international feet.
  • SQUARE_MILES_USThe area unit will be square US survey miles.
  • SQUARE_NAUTICAL_MILES_USThe area unit will be square US survey nautical miles.
  • ACRES_USThe area unit will be US survey acres.
  • SQUARE_YARDS_USThe area unit will be square US survey yards.
  • SQUARE_FEET_USThe area unit will be square US survey feet.
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
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.
  • DDThe coordinate format will be Decimal Degrees.
  • DMS_DIR_LASTThe coordinate format will be Degrees Minutes Seconds with cardinal direction component at the end (DDD° MM' SSS.ss" <N|S|E|W>).
  • DMS_DIR_FIRSTThe coordinate format will be Degrees Minutes Seconds with cardinal direction component at the beginning (<N|S|E|W> DDD° MM' SSS.ss").
  • DMS_POS_NEGThe coordinate format will be Degrees Minutes Seconds with positive or negative direction component at the beginning (<+|-> DDD° MM' SSS.ss").
  • DMS_PACKEDThe coordinate format will be Degrees Minutes Seconds packed into a single value with positive or negative direction component at the beginning (<+|-> DDD.MMSSSss).
  • DDM_DIR_LASTThe coordinate format will be Degrees Decimal Minutes with cardinal direction component at the end (DDD° MM.mmm' <N|S|E|W>).
  • DDM_DIR_FIRSTThe coordinate format will be Degrees Decimal Minutes with cardinal direction component at the beginning (<N|S|E|W> DDD° MM.mmm').
  • DDM_POS_NEGThe coordinate format will be Degrees Decimal Minutes with positive or negative direction component at the beginning (<+|-> DDD° MM.mmm').
  • GARSThe coordinate format will be Global Area Reference System. The Global Area Reference System is based on latitude and longitude, dividing and subdividing the world into cells.
  • GEOREFThe coordinate format will be 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.
  • MGRSThe coordinate format will be Military Grid Reference System.
  • USNGThe coordinate format will be United States National Grid.
  • UTMThe coordinate format will be Universal Transverse Mercator.
  • UTMNSThe coordinate format will be Universal 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.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"
arcpy.env.outputCoordinateSystem = arcpy.Describe("roads").spatialReference

# Set local variables
in_features = "roads"

# 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"]])