Points To Line (Data Management)

Summary

Creates line features from points.

Illustration

Point to line example

Usage

  • Line feature will not be written to the output if they are made up of less than two vertices.

Parameters

LabelExplanationData Type
Input Features

The point features to be converted into lines.

Feature Layer
Output Feature Class

The line feature class which will be created from the input points.

Feature Class
Line Field
(Optional)

Each feature in the output will be based on unique values in the Line Field.

Field
Sort Field
(Optional)

By default, points used to create each output line feature will be used in the order they are found. If a different order is desired, specify a Sort Field.

Field
Close Line
(Optional)

Specifies whether output line features should be closed.

  • Checked—An extra vertex will be added to ensure that every output line feature's end point will match up with its start point. Then polygons can be generated from the line feature class using the Feature To Polygon tool.
  • Unchecked—No extra vertices will be added to close an output line feature. This is the default.
Boolean

arcpy.management.PointsToLine(Input_Features, Output_Feature_Class, {Line_Field}, {Sort_Field}, {Close_Line})
NameExplanationData Type
Input_Features

The point features to be converted into lines.

Feature Layer
Output_Feature_Class

The line feature class which will be created from the input points.

Feature Class
Line_Field
(Optional)

Each feature in the output will be based on unique values in the Line Field.

Field
Sort_Field
(Optional)

By default, points used to create each output line feature will be used in the order they are found. If a different order is desired, specify a Sort Field.

Field
Close_Line
(Optional)

Specifies whether output line features should be closed.

  • CLOSEAn extra vertex will be added to ensure that every output line feature's end point will match up with its start point. Then polygons can be generated from the line feature class using the Feature To Polygon tool.
  • NO_CLOSENo extra vertices will be added to close an output line feature. This is the default.
Boolean

Code sample

PointsToLine Example (Python Window)

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

import arcpy
arcpy.env.workspace = "C:/data"
arcpy.PointsToLine_management("calibration_points.shp",
                              "C:/output/output.gdb/out_lines",
                              "ROUTE1", "MEASURE")
PointsToLine Example 2 (stand-alone script)

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

# Name: PointsToLine_Example2.py
# Description: Convert point features into line features

# Import system modules
import arcpy

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

# Set local variables
inFeatures = "calibration_points.shp"
outFeatures = "C:/output/output.gdb/out_lines"
lineField = "ROUTE1"
sortField = "MEASURE"

# Execute PointsToLine 
arcpy.PointsToLine_management(inFeatures, outFeatures, lineField, sortField)

Licensing information

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

Related topics