Add Geometry Attributes (Data Management)

Summary

Adds new attribute fields to the input features representing the spatial or geometric characteristics and location of each feature, such as length or area and x-, y-, z-, and m-coordinates.

Legacy:

This is a deprecated tool. This functionality has been replaced by the Calculate Geometry Attributes tool.

Usage

  • One or many attribute fields will be added to the input features depending on the options specified in the Geometry Properties parameter. If the fields already exist in the input features, the values in those fields will be overwritten. Use the following table to determine which fields will be added for each geometry property:

    Geometry propertyAdded field

    AREA

    POLY_AREA—The area of the polygon.

    AREA_GEODESIC

    AREA_GEO—The shape-preserving geodesic area of the polygon.

    CENTROID

    CENTROID_X—The x-coordinate of the centroid point.

    CENTROID_Y—The y-coordinate of the centroid point.

    CENTROID_Z—The z-coordinate of the centroid point. This field is only added if the input features are z-enabled.

    CENTROID_M—The m-coordinate of the centroid point. This field is only added if the input features are m-enabled.

    CENTROID_INSIDE

    INSIDE_X—The x-coordinate of a central point inside or on the input feature.

    INSIDE_Y—The y-coordinate of a central point inside or on the input feature.

    INSIDE_Z—The z-coordinate of a central point inside or on the input feature. This field is only added if the input features are z-enabled.

    INSIDE_M—The m-coordinate of a central point inside or on the input feature. This field is only added if the input features are m-enabled.

    EXTENT

    EXT_MIN_X—The minimum x-coordinate of the feature.

    EXT_MIN_Y—The minimum y-coordinate of the feature.

    EXT_MAX_X—The maximum x-coordinate of the feature.

    EXT_MAX_Y—The maximum y-coordinate of the feature.

    LENGTH

    LENGTH—The length of the line.

    LENGTH_GEODESIC

    LENGTH_GEO—The shape-preserving geodesic length of the line.

    LENGTH_3D

    LENGTH_3D—The 3D length of the line.

    LINE_BEARING

    BEARING—The start-to-end bearing of the line. Values range from 0 to 360, with 0 meaning north, 90 east, 180 south, and 270 west.

    LINE_START_MID_END

    START_X—The x-coordinate of the first point of the line or polygon border.

    START_Y—The y-coordinate of the first point of the line or polygon border.

    START_Z—The z-coordinate of the first point of the line or polygon border. This field is only added if the input features are z-enabled.

    START_M—The m-coordinate of the first point of the line or polygon border. This field is only added if the input features are m-enabled.

    MID_X—The x-coordinate of the point halfway along the length of the line or polygon border.

    MID_Y—The y-coordinate of the point halfway along the length of the line or polygon border.

    MID_Z—The z-coordinate of the point halfway along the length of the line or polygon border. This field is only added if the input features are z-enabled.

    MID_M—The m-coordinate of the point halfway along the length of the line or polygon border. This field is only added if the input features are m-enabled.

    END_X—The x-coordinate of the last point of the line or polygon border.

    END_Y—The y-coordinate of the last point of the line or polygon border.

    END_Z—The z-coordinate of the last point of the line or polygon border. This field is only added if the input features are z-enabled.

    END_M—The m-coordinate of the last point of the line or polygon border. This field is only added if the input features are m-enabled.

    PART_COUNT

    PART_COUNT—The number of parts composing the feature.

    PERIMETER_LENGTH

    PERIMETER—The length of the polygon perimeter or border.

    PERIMETER_LENGTH_GEODESIC

    PERIM_GEO—The shape-preserving geodesic length of the polygon perimeter or border.

    POINT_COUNT

    PNT_COUNT—The number of points composing the feature.

    POINT_X_Y_Z_M

    POINT_X—The x-coordinate of the point.

    POINT_Y—The y-coordinate of the point.

    POINT_Z—The z-coordinate of the point. This field is only added if the input features are z-enabled.

    POINT_M—The m-coordinate of the point. This field is only added if the input features are m-enabled.

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

  • The attribute fields added by this tool are similar to any fields that you can add to a feature layer. You can overwrite the field values, or delete or rename the fields. The values in these fields are not automatically recalculated after edits. If you edit the features, you'll need to run this tool again to update the field values.

  • If the input features have a selection, only the selected features will have values calculated in the added fields; all other features will have null values.

  • This tool works with point, multipoint, polyline, polygon, and annotation feature classes. Annotation is treated as a polygon feature class.

Parameters

LabelExplanationData Type
Input Features

The input features to which new attribute fields will be added to store properties such as length, area, or x-, y-, z-, and m-coordinates.

Feature Layer
Geometry Properties

Specifies the geometry or shape properties that will be calculated into new attribute fields.

  • AreaAn attribute will be added to store the area of each polygon feature.
  • Geodesic areaAn attribute will be added to store the shape-preserving geodesic area of each polygon feature.
  • Centroid coordinatesAttributes will be added to store the centroid coordinates of each feature.
  • Central point coordinatesAttributes will be added to store the coordinates of a central point inside or on each feature.
  • Extent coordinatesAttributes will be added to store the extent coordinates of each feature.
  • LengthAn attribute will be added to store the length of each line feature.
  • Geodesic lengthAn attribute will be added to store the shape-preserving geodesic length of each line feature.
  • 3D lengthAn attribute will be added to store the 3D length of each line feature.
  • Line bearingAn 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, and 270 west.
  • Line start, midpoint, and end coordinatesAttributes will be added to store the coordinates of the start, mid, and end points of each feature.
  • Number of partsAn attribute will be added to store the number of parts composing each feature.
  • Length of perimeterAn attribute will be added to store the length of the perimeter or border of each polygon feature.
  • Geodesic length of perimeterAn attribute will be added to store the shape-preserving geodesic length of the perimeter or border of each polygon feature.
  • Number of verticesAn attribute will be added to store the number of points or vertices composing each feature.
  • Point x-, y-, z-, and m-coordinatesAttributes will be added to store the x-, y-, z-, and m-coordinates of each point feature.
String
Length Unit
(Optional)

Specifies the unit in which the length will be calculated.

  • Feet (United States)Length in feet (United States)
  • MetersLength in meters
  • KilometersLength in kilometers
  • Miles (United States)Length in miles (United States)
  • Nautical miles (United States)Length in nautical miles (United States)
  • Yards (United States)Length in yards (United States)
String
Area Unit
(Optional)

Specifies the unit in which the area will be calculated.

  • AcresArea in acres
  • HectaresArea in hectares
  • Square miles (United States)Area in square miles (United States)
  • Square kilometersArea in square kilometers
  • Square metersArea in square meters
  • Square feet (United States)Area in square feet (United States)
  • Square yards (United States)Area in square yards (United States)
  • Square nautical miles (United States)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

LabelExplanationData Type
Modified Input Features

The updated input features.

Feature Layer

arcpy.management.AddGeometryAttributes(Input_Features, Geometry_Properties, {Length_Unit}, {Area_Unit}, {Coordinate_System})
NameExplanationData Type
Input_Features

The input features to which new attribute fields will be added to store properties such as length, area, or x-, y-, z-, and m-coordinates.

Feature Layer
Geometry_Properties
[Geometry_Properties,...]

Specifies the geometry or shape properties that will be calculated into new attribute fields.

  • AREAAn attribute will be added to store the area of each polygon feature.
  • AREA_GEODESICAn attribute will be added to store the shape-preserving geodesic area of each polygon feature.
  • CENTROIDAttributes will be added to store the centroid coordinates of each feature.
  • CENTROID_INSIDEAttributes will be added to store the coordinates of a central point inside or on each feature.
  • EXTENTAttributes will be added to store the extent coordinates of each feature.
  • LENGTHAn attribute will be added to store the length of each line feature.
  • LENGTH_GEODESICAn attribute will be added to store the shape-preserving geodesic length of each line feature.
  • LENGTH_3DAn attribute will be added to store the 3D length of each line feature.
  • LINE_BEARINGAn 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, and 270 west.
  • LINE_START_MID_ENDAttributes will be added to store the coordinates of the start, mid, and end points of each feature.
  • PART_COUNTAn attribute will be added to store the number of parts composing each feature.
  • PERIMETER_LENGTHAn attribute will be added to store the length of the perimeter or border of each polygon feature.
  • PERIMETER_LENGTH_GEODESICAn attribute will be added to store the shape-preserving geodesic length of the perimeter or border of each polygon feature.
  • POINT_COUNTAn attribute will be added to store the number of points or vertices composing each feature.
  • POINT_X_Y_Z_MAttributes will be added to store the x-, y-, z-, and m-coordinates of each point feature.
String
Length_Unit
(Optional)

Specifies the unit in which the length will be calculated.

  • FEET_USLength in feet (United States)
  • METERSLength in meters
  • KILOMETERSLength in kilometers
  • MILES_USLength in miles (United States)
  • NAUTICAL_MILESLength in nautical miles (United States)
  • YARDSLength in yards (United States)
String
Area_Unit
(Optional)

Specifies the unit in which the area will be calculated.

  • ACRESArea in acres
  • HECTARESArea in hectares
  • SQUARE_MILES_USArea in square miles (United States)
  • SQUARE_KILOMETERSArea in square kilometers
  • SQUARE_METERSArea in square meters
  • SQUARE_FEET_USArea in square feet (United States)
  • SQUARE_YARDSArea in square yards (United States)
  • SQUARE_NAUTICAL_MILESArea 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

NameExplanationData Type
Modified_Input_Features

The updated input features.

Feature Layer

Code sample

AddGeometryAttributes example (Python window)

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

import arcpy
arcpy.env.workspace = r"C:\data\City.gdb"
arcpy.AddGeometryAttributes_management("roads", "LENGTH;LINE_START_MID_END")
AddGeometryAttributes example (stand-alone script)

Get the extent rectangle of each line feature and build a 10 by 10 grid within that extent.

# Name: GridCreation.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"
properties = "EXTENT"
length_unit = ""
area_unit = ""
coordinate_system = ""

# Generate the extent coordinates using Add Geometry Properties tool
arcpy.AddGeometryAttributes_management(in_features, properties, length_unit,
                                       area_unit, coordinate_system)

# Use Search Cursor to walk through each feature and generate grids
with arcpy.da.SearchCursor(in_features, ["OID@", "EXT_MIN_X", "EXT_MIN_Y",
                                         "EXT_MAX_X", "EXT_MAX_Y"]) as sCur:
    for row in sCur:
        minX, minY, maxX, maxY = row[1], row[2], row[3], row[4]
        arcpy.CreateFishnet_management("fishnet_{0}".format(row[0]),
                    number_rows = 10,
                    number_columns = 10,
                    template = "{} {} {} {}".format(minX, maxX, minY, maxY),
                    origin_coord = "{} {}".format(minX, minY),
                    y_axis_coord = "{} {}".format(minX, maxY),
                    corner_coord = "{} {}".format(maxX, maxY),
                    geometry_type = "POLYGON",
                    labels = "NO_LABELS")

Licensing information

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