I am trying to run points to line tool for my feature class of points. Each point has an associated pair which can be identified by the line field "ORIG_FID". I've QA/QC the data to ensure there are no unique values and there are only pairs for this field. Below is the script for this tool with my inputs:
arcpy.management.PointsToLine(
Input_Features="channel_boundaries_range",
Output_Feature_Class=r"C:\Users\kennkath\Desktop\LabWork\Thesis\Methods\Chapter2\Alsea_Katie\Alsea_Katie\channel_boundaries_range_widths1.shp",
Line_Field="ORIG_FID",
Sort_Field=None,
Close_Line="NO_CLOSE",
Line_Construction_Method="CONTINUOUS",
Attribute_Source="NONE",
Transfer_Fields=None
This is the error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 4623, in PointsToLine
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 4620, in PointsToLine
retval = convertArcObjectToPythonObject(gp.PointsToLine_management(*gp_fixargs((Input_Features, Output_Feature_Class, Line_Field, Sort_Field, Close_Line, Line_Construction_Method, Attribute_Source, Transfer_Fields), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 520, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: TypeError: fields size must match size of the row
Failed to execute (PointsToLine).
Hi @KatherineKennedy ,
Have you tried running the Points To Line gp tool directly from ArcGIS Pro? Do you experience the same error when running the standalone gp tool?
I am getting the same error when I run the tool directly in ArcGIS pro.
I would test with another sample point feature as Input Feature for the Points To Line gp tool in ArcGIS Pro and see if the same error still persists. We would like to see if this issue is specific to your data (channel_boundaries_range) or not.
From the Python (code sample 3) for the Points to Line GP tool, created this Python script changing the values to apply to your parameters.
# Description: Convert point features into line features
# Import system modules
import arcpy
# Set environment settings
arcpy.env.workspace = "C:\Users\kennkath\Desktop\LabWork\Thesis\Methods\Chapter2\Alsea_Katie\Alsea_Katie\"
# Set local variables
inFeatures = "channel_boundaries_range.shp"
outFeatures = "channel_boundaries_range_widths1.shp"
lineField = "ORIG_FID"
sortField = "MEASURE"
# Run PointsToLine
arcpy.management.PointsToLine(inFeatures, outFeatures, lineField, sortField, "NO_CLOSE", "CONTINUOUS", "NONE", "NONE")
There is no measure field in my data, is there something else you were referring to with this suggestion?
I was able to work with Katie yesterday on this issue. There certainly was not much reference to this in any forums or documentation. It turns out that the field being used as the Line Field in the Points to Lines tool contained a starting pair with ORIG_ID = "0". The table was not sorted so it was not obvious where the error was occurring. Once the zero was changed or removed the tool worked properly. Hopefully this is helpful to those who might encounter this issue.
I found that this tool had the same error when there were any columns with <Null> if that is helpful. I filled the <Null> with NA and then deleted those lines as a work around.