Calculate Polygon Main Angle (Cartography)

Summary

Calculates the dominant angles of input polygon features and assigns the values to a field to use to orient symbology such as markers or hatch lines within the polygons.

Illustration

Calculate Polygon Main Angle tool illustration.
The dominant polygon angle as applied to interior symbology is demonstrated for the three rotation methods.

Usage

  • The dominant angle of a polygon is the angle of the longest collection of segments that have similar orientation. For the purpose of symbol rotation, polygons are considered to be oriented upright when the dominant angle is horizontal. The angle perpendicular to the dominant polygon angle is recorded because this results in the expected orientation when using the value for symbol rotation.

  • The angle perpendicular to the dominant angle of the polygon will be stored in the specified field in decimal degrees from the origin point of the rotation method.

  • This tool is primarily for orthogonal polygons rather than polygons that are organically shaped.

Parameters

LabelExplanationData Type
Input Features

The input polygon features.

Feature Layer
Angle Field

The field that will be updated with the polygon main angle values.

Field
Rotation Method
(Optional)

Specifies the method and origin point of rotation that will be used..

  • GeographicThe angle will be calculated clockwise with 0 at the top (north).
  • ArithmeticThe angle will be calculated counterclockwise with 0 at the right (east).
  • GraphicThe angle will be calculated counterclockwise with 0 at the top (north). This is the default.
String

Derived Output

LabelExplanationData Type
Updated Input Features

The updated input polygon features.

Feature Layer

arcpy.cartography.CalculatePolygonMainAngle(in_features, angle_field, {rotation_method})
NameExplanationData Type
in_features

The input polygon features.

Feature Layer
angle_field

The field that will be updated with the polygon main angle values.

Field
rotation_method
(Optional)

Specifies the method and origin point of rotation that will be used..

  • GEOGRAPHICThe angle will be calculated clockwise with 0 at the top (north).
  • ARITHMETICThe angle will be calculated counterclockwise with 0 at the right (east).
  • GRAPHICThe angle will be calculated counterclockwise with 0 at the top (north). This is the default.
String

Derived Output

NameExplanationData Type
out_features

The updated input polygon features.

Feature Layer

Code sample

CalculatePolygonMainAngle example 1 (Python window)

The following Python window script demonstrates how to use the CalculatePolygonMainAngle function in immediate mode.

import arcpy
arcpy.env.workspace = "C:\data"
arcpy.cartography.CalculatePolygonMainAngle("cities", "poly_angle", "GEOGRAPHIC")
CalculatePolygonMainAngle example 2 (stand-alone script)

This stand-alone script shows an example of using the CalculatePolygonMainAngle function.

# Name: CalculatePolygonMainAngle_standalone_script.py
# Description: Calculates the dominant angles of input polygon features and 
#              assigns the values to a specified field in the feature class

# Import system modules
import arcpy

# Set environment settings
arcpy.env.workspace = "C:/data"

# Set local variables
in_features = "cartography.gdb/buildings_area"
angle_field = "poly_angle"
rotation_method = "ARITHMETIC"

# Execute Calculate Polygon Main Angle
arcpy.CalculatePolygonMainAngle_cartography(in_features, angle_field, 
                                            rotation_method)

Licensing information

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

Related topics