Generate Transects Along Lines (Data Management)

Summary

Creates perpendicular transect lines at a regular interval along lines.

Usage

  • This tool works best when the input features have a projected coordinate system appropriate for distance measurements in a local area. Equidistant, UTM, or other localized coordinates systems are well suited for distance measurement. Coordinate systems that distort distance to provide more cartographic shapes, such as Web Mercator, or geographic coordinate systems may not have accurate results.

  • The output of this tool has only one attribute, ORIG_FID, which stores the Object ID of the input feature along which each transect line was generated. You can use this field to add additional attributes from the input features to the output transect lines by running the Add Join or Join Field tool.

Syntax

arcpy.management.GenerateTransectsAlongLines(in_features, out_feature_class, interval, transect_length, {include_ends})
ParameterExplanationData Type
in_features

The line features along which perpendicular transect lines will be generated.

Feature Layer
out_feature_class

The output perpendicular transect lines generated along the input features.

Feature Class
interval

The interval from the beginning of the feature at which transects will be placed.

Linear Unit
transect_length

The length or width of the transect line. Each transect will be placed in such a way along the input line that half its length falls on one side of the line, and half its length falls on the other side of the line.

This is the overall length of each transect line, not the distance that the transect extends from the input line. To specify how far the transect line should extend from the input line—for example, 100 meters—double this value to specify the transect length (200 meters).

Linear Unit
include_ends
(Optional)

Specifies whether transects will be generated at the start and end of the input line.

  • END_POINTSTransects will be generated at the start and end of the input line.
  • NO_END_POINTSTransects will not be generated at the start and end of the input line. This is the default.
Boolean

Code sample

GenerateTransectsAlongLines example 1 (Python window)

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

import arcpy
arcpy.env.workspace = 'C:/data/base.gdb'
arcpy.GenerateTransectsAlongLines_management('rivers', 'river_sample_transects',
                                             '100 Meters', '100 Meters', 
                                             'NO_END_POINTS')
GenerateTransectsAlongLines example 2 (stand-alone script)

The following stand-alone script demonstrates how to use GenerateTransectsAlongLines.

# Description: Add sampling perpendicular transect lines along a river

import arcpy

# Set environment settings
arcpy.env.workspace = 'C:/data/base.gdb'

# Set local variables
in_features = 'rivers'
out_fc_1 = 'river_samples_transects'

# Execute GeneratePointsAlongLines by distance
arcpy.GenerateTransectsAlongLines_management(in_features, out_fc_1, '100 Meters',
                                             '100 meters', 'END_POINTS')

Environments

Licensing information

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

Related topics