Points To Line GP tool: Support multi-part polylines

04-15-2022 04:18 PM
Status: Open
Labels (1)
Frequent Contributor

As far as I can tell, the Points To Line GP tool can’t be used to create multi-part polylines:

Points To Line GP tool

ASSET_ID     PART_NUM VERTEX_NUM          X          Y          M
---------- ---------- ---------- ---------- ---------- ----------
001                 1          1          0          5          0
001                 1          2         10         10      11.18
001                 1          3         30          0      33.54
001                 2          1         50         10      33.54
001                 2          2         60         10      43.54


Could support for multi-part features be added?



I think this is a good idea, improves the tool beyond its basic function.  This is a script tool and you could actually edit the python code if you feel brave enough, although I would recommend you back up the source code first in case you mess it up. Looking at the code it's obviously an old tool as the cursors they use are the older slower variety so changing them to the cursors in the da module could even speed things up. If any of the ESRI developers are reading this may be it's time to review some of your earlier scripting tools and bring them up to date?

As an alternative work around you could explore this workflow:

  1. Convert your text table into a CSV file
  2. Using the XY Table to Point to convert them into a point dataset
  3. Concatenate ASSET_ID and PART_NUM into a single text field
  4. Use point to line tool to convert to lines but use the concatenated field as the Line Field parameter
  5. Run Join Field and  and join on concatenated field, joining back the ASSET_ID
  6. Run Dissolve, dissolving on ASSET_ID and ensure create multipart features is ticked on

This could all be packaged up as a model tool.


@DuncanHornby Thanks Duncan. That helps.

Good call about cursors. I posted an idea just now for that: Update OOTB GP tools so that they use the new DA cursors.