ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Points To Line

  • Summary
  • Illustration
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Creates line features from points.

Illustration

Points To Line tool illustration

Usage

  • Line features are only written to the output if the line will contain two or more vertices.

  • You can create polygons from the tool output by first using the Close Line parameter to close all output line features. You can then use the output line feature class as input to the Feature To Polygon tool.

Syntax

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

The point features to be converted into lines.

Feature Layer
Output_Feature_Class

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

Feature Class
Line_Field
(Optional)

The field that will be used to identify unique attribute values. Point features with a unique attribute value will be combined to form an output line feature.

Field
Sort_Field
(Optional)

The field that will be used to sort the order of the points. By default, points used to create each output line feature will be used in the order they are found.

Field
Close_Line
(Optional)

Specifies whether output line features will be closed.

  • CLOSE —An extra vertex will be added to ensure that every output line feature's end point will match its start point
  • NO_CLOSE —No 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 the PointsToLine function.

# 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)

Environments

  • Current Workspace
  • Scratch Workspace
  • XY Resolution
  • XY Tolerance
  • Output has M values
  • M Resolution
  • M Tolerance
  • Output has Z values
  • Default Output Z Value
  • Z Resolution
  • Z Tolerance
  • Qualified Field Names
  • Output CONFIG Keyword
  • Auto Commit
  • Output Spatial Grid 1
  • Output Spatial Grid 2
  • Output Spatial Grid 3
  • Output XY Domain
  • Output M Domain
  • Output Z Domain

Licensing information

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

Related topics

  • An overview of the Features toolset

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal