Skip To Content

Polygon To Centerline

Summary

Creates centerlines from polygon features. This tool is useful for creating centerlines from hydrographic polygons for use at smaller scales.

Illustration

Before and after illustration of the Polygon To Centerline process

Usage

  • This tool is optimized for spatial relationships and junctions typically found in a hydrographic network. Examples of these are long, thin polygons such as rivers or canals. This tool is also optimized for junctions that occur on the same elevation, such as when rivers converge. However, the tool does not handle junctions that occur on different levels, such as when highway overpasses cross over one another.

  • For best results, consider running the Dissolve tool to dissolve touching polygon features before running Polygon To Centerline. While this tool checks spatial relationships between the input features to ensure centerlines connect when input features touch, running dissolve first may achieve a cleaner result in some situations.

  • The integrity of the output relies on the topological integrity of the inputs. Take note of the following input data requirements and suggestions:

    • Empty or null geometry—The Input Features parameter must consist of valid geometries. If necessary, use the Repair Geometry tool to repair these features.
    • Overlapping geometries—The connecting features hidden behind input features may generate visually impaired centerlines.
    • Nonlinear segments—Bézier curve, circular arc, and elliptic arc segments may compromise the quality of the results.

  • The output centerlines will not contain any geographic attributes from the input polygon features. A field named FID will be added to the Output Feature Class parameter. This field is populated with the ObjectID of the polygon from which the centerline was created, which can be used to join the centerlines to the input polygons. If a process such as Dissolve or Eliminate Polygon Part was run on the original polygons to prepare the data before running Polygon To Centerline, the FID field will link to the prepared polygons, not the original polygons. The Identity tool can be run using the original polygons to split the centerlines and identify the original polygon that contains the centerline.

  • The output will include a field named FID_[input feature class name]. If the centerline touches a feature in the input feature class that is not the feature used to create the centerline, the field will be populated with the ObjectID of the touching input feature. If the centerline does not touch any other input features, the value in the field will be NULL.

  • The output will include a field for each feature class chosen as Connecting Features. The field will be named FID_[connecting feature class name]. If the centerline touches a feature in the connecting feature class, the field will be populated with the ObjectID of the touching feature. If the centerline does not touch any connecting features, the value in the field will be NULL.

  • For best results, consider running the Eliminate Polygon Part tool first to remove small holes in the polygon features, for example, to remove holes from the middle of river polygons where island polygons exist. If a hole exists in the polygon, the centerline will branch around the hole, potentially creating two short centerline segments. Filling small holes before running Polygon To Centerline will create a single centerline through the section where a hole previously existed.

  • The tool applies an adaptive densification to the input features to improve centerline quality. Although it is not necessary to densify input features prior to running this tool, simplifying input geometries may speed up the process due to the reduced number of vertices.

  • Flow direction will be honored only for the connecting line features. If there are none, the flow direction will follow the longest path starting at an end point.

  • In addition to connecting features, the tool will use the input features to identify whether any of them are touching each other and can be used to refine the centerlines.

  • The tool may not honor touch points if the input and connecting features have different coordinate systems.

  • The output will only contain single-part geometries; centerlines will be split at the junctions, and each path will be written as a separate feature to the output table.

Syntax

PolygonToCenterline_topographic (in_features, out_feature_class, {connecting_features})
ParameterExplanationData Type
in_features

The polygon features that will be used to create the centerline.

Feature Layer
out_feature_class

The output feature class for the centerlines.

Feature Class
connecting_features
[connecting_features,...]
(Optional)

The features to be used to ensure connectivity of the centerline with other features in a network. The centerline will link to the point or the shared boundary wherever a feature from a connecting feature class touches the input feature.

Feature Layer

Code sample

PolygonToCenterline example (stand-alone script)

The following stand-alone sample script demonstrates how to use the PolygonToCenterline tool to create a centerline from a polygon feature.

# Name: PolygonToCenterline_sample.py
# Description: Select the rivers and produce centerlines

# Import arcpy module
import arcpy

# Check out Production Mapping License
arcpy.CheckOutExtension("foundation")

# Define variables
in_features = r'C:\data\CTM.gdb\CTM\HydrographySrf'
out_feature_class = r'C:\data\CTM.gdb\CTM\HydrographyCrvOut'

# Select only the Rivers subtype
inputLyr = arcpy.MakeFeatureLayer_management(in_features, "inputLyr", "FCSubtype =  100314")

# Execute Polygon To Centerline
arcpy.topographic.PolygonToCenterline(inputLyr, out_feature_class)

# Check in Production Mapping License
arcpy.CheckInExtension("foundation")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Requires Production Mapping
  • Advanced: Requires Production Mapping

Related topics