Calculate Geometry Fields Attribute Rule (Data Management)

Summary

Generates an attribute rule that calculates a feature's geometry information and writes it to a given field. Geometry attributes represent the spatial or geometric characteristics and location of each feature, such as length or area and x-, y-, z-coordinates, and m-values.

Usage

  • Length and area calculations will be in the units of the input features' 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 optional coordinate format parameter requires spatial reference of the input tables to be a geographic coordinate system.

  • Tool will fail to run if the input class is being edited.

  • Rules created with this tool are configured to trigger only on edits to the SHAPE field and fields set as a target for geometry calculations.

Parameters

LabelExplanationData Type
Input Table

The table or feature class that will have the new rule applied.

Feature Layer; Annotation Layer; Dimension Layer; Oriented Imagery Layer; Catalog Layer
Output Folder

The folder where the output will be saved.

Folder
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 angle— An attribute will be added to store the start-to-end arithmetic angle of each line feature. Values range from 0 to 360, with 0 meaning east, 90 north, 180 west, 270 south, 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 comprising each feature.
  • Number of vertices—An attribute will be added to store the number of points or vertices comprising 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
Expression
(Optional)

An SQL expression that will be used to limit the features from the input that will participate in the attribute rule.

SQL Expression
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 Format
(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.

String

Derived Output

LabelExplanationData Type
Output Rule CSV

The .csv file that will have the attribute rule.

File

arcpy.management.CalculateGeometryFieldsAttributeRule(in_table, out_folder, geometry_attributes, {where_clause}, {length_unit}, {area_unit}, {coordinate_format})
NameExplanationData Type
in_table

The table or feature class that will have the new rule applied.

Feature Layer; Annotation Layer; Dimension Layer; Oriented Imagery Layer; Catalog Layer
out_folder

The folder where the output will be saved.

Folder
geometry_attributes
[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—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_ANGLE—An attribute will be added to store the start-to-end arithmetic angle 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 comprising each feature.
  • POINT_COUNT—An attribute will be added to store the number of points or vertices comprising 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
where_clause
(Optional)

An SQL expression that will be used to limit the features from the input that will participate in the attribute rule.

SQL Expression
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_format
(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.

String

Derived Output

NameExplanationData Type
out_rule_csv

The .csv file that will have the attribute rule.

File

Code sample

CalculateGeometryFieldsAttributeRule example (Python window)

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

import arcpy
arcpy.env.workspace = r"C:\data\City.gdb"
arcpy.management.CalculateGeometryFieldsAttributeRule(
    in_table="test_class",
    out_folder=r"C:\temp", 
    geometry_attributes="area_field AREA_GEODESIC",
    where_clause="OBJECTID = 1",
    length_unit="",
    area_unit="SQUARE_MILES_US",
    coordinate_format=""
)

Environments

This tool does not use any geoprocessing environments.

Licensing information

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

Related topics