Generate Rectangles Along Lines (Data Management)

Summary

Creates a series of rectangular polygons that follow a single linear feature or a group of linear features.

Illustration

Output rectangles generated along input line features.

Usage

  • The resulting features are created with a number of attributes:

    • ID—An incremental number assigned to each feature.
    • GroupId—An integer assigned to all the features in a connecting chain or group of line features. Generate Rectangles Along Lines results can include multiple groups. Usually, a single group will originate from a connected set of line features or from a single line with multiple, unconnected parts. Features created from individual, unconnected line features will be assigned to separate groups. GroupId values are unique and are derived from the ObjectID of the first line feature in the given chain.
    • SeqId—An incremental number assigned to each feature based on the creation order for the feature in each group.
    • Previous—A reference to the previous SeqId in each group except for the first record in each group. The first record could reference a neighboring element outside the group.
    • Next—A reference to the next SeqId in each group except for the last record in each group. The last record could reference a neighboring element outside the group.
    • Angle—Values are calculated against the default orientation of a map where 0 degrees is due North, 90 degrees is due East, 180 degrees is due South and -90 degrees is due West.

  • The default units for Length Along the Line and Length Perpendicular to the Line will automatically change to the units of the spatial reference of the input line features.

Parameters

LabelExplanationData Type
Input Line Features

The input polyline features defining the path of the features.

Feature Layer
Output Feature Class

The output polygon feature class.

Feature Class
Length Along the Line
(Optional)

The length of the output polygon features along the input line features. The default value is determined by the spatial reference of the input line features. This value will be 1/100 of the input feature class extent along the x-axis.

Linear Unit
Length Perpendicular to the Line
(Optional)

The length of the output polygon features perpendicular to the input line features. The default value is determined by the spatial reference of the input line features. This value will be one-half the number used for the length along the line.

Linear Unit
Spatial Sort Method
(Optional)

Output features are created in a sequential order and require a spatial starting point. Setting the direction type to upper right will start the output features in the upper right of each input feature.

  • Upper rightFeatures start in the upper right corner. This is the default.
  • Upper leftFeatures start in the upper left corner.
  • Lower rightFeatures starts in the lower right corner.
  • Lower leftFeatures starts in the lower left corner.
String

arcpy.management.GenerateRectanglesAlongLines(in_features, out_feature_class, {length_along_line}, {length_perpendicular_to_line}, {spatial_sort_method})
NameExplanationData Type
in_features

The input polyline features defining the path of the features.

Feature Layer
out_feature_class

The output polygon feature class.

Feature Class
length_along_line
(Optional)

The length of the output polygon features along the input line features. The default value is determined by the spatial reference of the input line features. This value will be 1/100 of the input feature class extent along the x-axis.

Linear Unit
length_perpendicular_to_line
(Optional)

The length of the output polygon features perpendicular to the input line features. The default value is determined by the spatial reference of the input line features. This value will be one-half the number used for the length along the line.

Linear Unit
spatial_sort_method
(Optional)

Output features are created in a sequential order and require a spatial starting point. Setting the direction type to upper right will start the output features in the upper right of each input feature.

  • URFeatures start in the upper right corner. This is the default.
  • ULFeatures start in the upper left corner.
  • LRFeatures starts in the lower right corner.
  • LLFeatures starts in the lower left corner.
String

Code sample

GenerateRectanglesAlongLines example (Python window)

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

import arcpy
arcpy.env.workspace = r"C:\data\US_Streams.gdb"
arcpy.management.GenerateRectanglesAlongLines("StreamReach", "riparian_zones", 
                                              "250 Meters", "180 Meters", "UR")

Environments

Related topics