I have a polyline feature class containing conjoined line features. Each line is composed of multiple individual lines separated by vertices. I would like to either isolate the central line in the image and extract it, or remove the tributary lines that are running perpendicular to the centre line as in the image. I have no attributes to select on but do have a bounding polygon that could potentially be used. The yellow dots in the image represent the start and end vertices of each line. Manually, I can select each individual line that I don't want and delete but the eventual aim of this is to automate within a Python script. The 'Trim line' tool in ArcGIS Pro does what I want but I have to run it tens of times and also trims the ends of the central line that I want to keep.
1 Answer
Assuming this represents the skeleton of a lake I can think of several ways to automate the trimming back to the centreline. But they all have a flaw, how do you identify the inlets/outlet of the lake and exclude those from any trimming operation. You need to have previously flagged these in some way which inevitably means a manual intervention and thus the usefulness of a scripted approach is undermined.
You give no indication of the size of the data, so you have a few lakes or millions with billions of internal lines.
A fairly quick approach that will combine the operation of identifying your inlets/outlet and the extraction of the centreline with manual intervention is to convert your polyline dataset to a network dataset (see ArcGIS Pro help) and then drop a couple of flags and solve shortest route. You can then select/export the route. This approach requires no coding and can be done in seconds once you have created your network dataset.
-
Thanks. They are indeed skeletons but not lakes so inlets/outlets aren't an issue. There are no geometric issues so I think the main challenge is stripping everything back to leave the central 'spine'. Commented Apr 14, 2021 at 15:56
-
1So what are they? Do at least 2 of your nodes (yellow vertices) need to be touching the polygon perimeter which would be the start and end of your centreline? If so how do you distinguish between them and all other perimeter touching nodes?– HornbyddCommented Apr 14, 2021 at 16:26