0

enter image description here

I have a long and complicated polyline (screenshot is showing part of it). Now,I'm trying to find a way to select part of it (cannot be done by simply selecting features dues to the way the polyline is in the data source). I'm thinking that if I manually added in two vertex, like shown as the green dots, and I can use arcpy.da.SearchCursor to find all vertices location.

Is it possible to quantify an order so that I can capture points between these two green dots? For example, larger than starting point and smaller than end point this kind of relationship. I have tried it, doesn't seem to work. If I selected by that order, weird vertices will come in (this is just part of the polyline, there are a lot more all over the place).

I guess my goal is to find a way to capture all vertices existed on this line between two manually identified vertices. And then extract these points and create a new polyline with arcpy.polyline function so that I can automate the process of only retaining the line segments I want.

Vince
  • 20,017
  • 15
  • 45
  • 64
user40003
  • 101
  • 1
    The geometry object can be broken down to points https://gis.stackexchange.com/questions/26369/getting-all-the-points-of-polyline. The points iterate sequentially from start to finish for each part, iterate the point using distanceTo https://resources.arcgis.com/en/help/main/10.2/index.html#/PointGeometry/018z00000039000000/, when it's 0 start adding the points into an arcpy.Array then keep going until the distanceTo the other point is 0 and create the new polyline from the Array. Look at the example code https://resources.arcgis.com/en/help/main/10.2/index.html#/Polyline/018z00000008000000/ – Michael Stimson Jun 06 '23 at 04:14
  • 1
    It's not possible to select a part of a geometry. But you can split geometries and copy portions, and collect vertices to make new features,... the list is pretty comprehensive. Since there's a number of ways to do this, you probably want to try one, the report any difficulty, vice asking if it's possible. – Vince Jun 06 '23 at 04:15
  • 1
    You could use linear referencing to turn it into a route and use two measure values to create a linear event, that can be copied into a line feature. – PolyGeo Jun 06 '23 at 07:41
  • As you have tagged your question ArcPro related another option is to use the Polyline method segmentAlongLine. – Hornbydd Jun 06 '23 at 11:56
  • Hi Michael, I sort of get what you mean, but how does the array arrange each point sequaentially? For example, if there is a branch coming off a vertex, and I iterate from this vertex, which way does it go? – user40003 Jun 06 '23 at 16:45
  • A single part polyline cannot branch, to do so would require a multipart feature; in the example code from Esri they iterate each part, though it would be best to only use single part features. As I understand your question you're looking to create a new polyline from an existing polyline between two vertices, is that not what you're trying to do? – Michael Stimson Jun 07 '23 at 23:42

0 Answers0