Summary
Creates a polyline feature class from coordinates stored in a table.
Usage
Fields from the input table will not be copied to the output polyline feature class.
Syntax
arcpy.defense.CoordinateTableToPolyline(in_table, out_feature_class, x_or_lon_field, in_coordinate_format, {y_or_lat_field}, {line_group_field}, {sort_field}, {coordinate_system})
Parameter | Explanation | Data Type |
in_table | The table containing the source coordinates. | Table View |
out_feature_class | The feature class containing the output polyline features. | Feature Class |
x_or_lon_field | The field in the input table containing the x or longitude coordinates. | Field |
in_coordinate_format | Specifies the format of the input table coordinates.
| String |
y_or_lat_field (Optional) | The field in the input table containing the y or latitude coordinates. The y_or_lat_field parameter is used when the in_coordinate_format parameter is set to DD_2, DDM_2, or DMS_2. | Field |
line_group_field (Optional) | The field in the input table field used to create unique polylines. A polyline will be created for each unique value. | Field |
sort_field (Optional) | The field in the input table used to order the polyline vertices. The field must be numeric. | Field |
coordinate_system (Optional) | The spatial reference of the output feature class. The default is GCS_WGS_1984. | Spatial Reference |
Code sample
The following Python window script demonstrates how to use the CoordinateTableToPolyline function.
import arcpy
arcpy.env.workspace = r"C:/Data.gdb"
arcpy.CoordinateTableToPolyline_defense(r"C:/CSV/TableToPolyline.csv",
"Out_Polyline", "POINT_X", "DD_2",
"POINT_Y", "Group_")
The following Python example shows how to use the CoordinateTableToPolyline function in a sample workflow.
# Description: Create polylines from tabular data and find a representative
# center point of each line.
# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = r"C:/Data.gdb"
arcpy.env.overwriteOutput = True
# Create polylines
input_table = r"C:/CSV/TableToPolyline.csv"
result_line = "Output_Polyline"
arcpy.CoordinateTableToPolyline_defense(input_table, result_line, "POINT_X",
"DD_2", "POINT_Y", "Group_")
# Find representative center point
result_center = "Output_Centers"
arcpy.FeatureToPoint_management(result_line, result_center)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes