[ArcGIS] A solution to 99999 errors reported by PointsToLine

ArcToolbox / data management tools / features / point set to line

PointsToLineThe function is to connect discrete points into a polyline. When using this tool, you need to specify the point layer (input feature) used for the polyline, and the ID field (line field) used to distinguish different individuals. It is used to determine the order of the point connection order. Field. A very common use of this function is to connect taxi GPS signals into a continuous broken line.

Make the settings according to the usage requirements, and report 999999errors when executing , for unknown reasons. One of the solutions to this problem:

  1. Create an empty point feature class and add two fields, ID and ORDER_FIELD, to store the line and sort fields of the origin feature class;
  2. Copy each feature of the origin feature class to the new feature class, and do a good job of mapping the line fields and sort fields. Because the amount of data is relatively large, I used arcpy.da.InsertCursor()to insert the features and fields of the origin feature class into the new feature class;
  3. The point set to line method was successfully executed on this new feature class.

Attachment: Insert feature script

#!/usr/bin/env python2
# -*- coding: utf-8 -*-

import arcpy

in_fc = ""
out_fc = ""

search_fields = ["x", "y", "id_field", "order_field"]
insert_fields = ("SHAPE@", "ID", "ORDER_FIELD")
with arcpy.da.InsertCursor(out_fc, insert_fields) as insert_cursor:
	with arcpy.da.SearchCursor(in_fc, search_fields) as search_cursor:
		for srow in search_cursor:
			x = srow[0]
			y = srow[1]
			point = arcpy.Point(x, y)
			id_field = srow[2]
			order_field = srow[3]
			insert_cursor.insertRow((point, id_field, order_field))

print "---------- Done! ----------"
71 original articles published · 56 praises · 90,000 + views

Guess you like

Origin blog.csdn.net/baidu_26646129/article/details/103940220