2

I have a very specific question about searchcursor traversing complex polyline.

My setup is: I imported public transport routes as a single polyline with length in meters. Along this polyline I want to place points with equal distance between them. For that I have found these tools:

After creating a route from lines with unique start and end points the results from the toolboxes are the same (eventhough the polyline is still multipart, see comments). Now it is also consistent with Construct points editing tool.

Construct points tool shows before constructing the line directions as follows:

line directions from Create points

So, my question is how does the search cursor traverse through the polyline parts in red squares? (i have added the squares for clarity)

  • 1
    Commenting because I don't know for certain (Esri would), but I think the cursor will simply progress in the sequence in which each row/record exists on disk; i.e., it doesn't follow a spatial logic, but rather the file's written sequence. If you want it to go in a certain spatial direction, you might have to sort the rows/records yourself (e.g., on x,y coordinates) before running the cursor. – Paulo Raposo Dec 8 '15 at 7:34
  • 1
    Technically it is the arcpy geometry object captured from the polyline shape field that you are traversing. You can sequence through all parts of a multi-part line if you use code similar to this calculation geonet.esri.com/blogs/richard_fairhurst/2015/06/07/… The order of parts and part orientations created by dissolve are not necessarily going to be in the desired sequence or logical from a travel perspective. You may have to extract and examine the parts in code to order them to progress in the optimum order. – Richard Fairhurst Dec 8 '15 at 20:12
  • 1
    You should look into the Network Analyst extension if you are interested in optimizing travel paths on a road or line network, . It includes solvers that can respect various parameters such as varying speed limits, one-way restrictions, turn restrictions, etc. It has many other tools related to network analysis, such as the ability to produce network service area boundaries. – Richard Fairhurst Dec 8 '15 at 20:25
  • 1
    I personally only build simple routes and if there are different paths based on travel direction I assign two attributes to build routes for north or east routes separate from south or west routes. Bidirectional portions of direction dependent routes have both fields assigned a rute ID value and I build two routes with those segments. In other cases I build a main line route and assign different route IDs to all minor segments that would create unwanted branching. All my routes rebuild every week and this has worked for me for years. – Richard Fairhurst Dec 8 '15 at 22:29
  • 1
    I don't consider it off-topic. Only simple non-branching routes can be used to create routes with evenly spaced points. Any pattern of evenly spaced points will logically be a product of you isolating a main line route by removing the unwanted branches and then handling the spacing of points on the branches separately. Dissolve and merge will only work if you follow those simple route rules. Using the two fields and Create Route tool to build simple routes takes less time than any programmatic geometry manipulation or effort to manually control the merge process one segment at a time. – Richard Fairhurst Dec 8 '15 at 23:11
1

From your comment:

my general aim would be to put the equidistant points on a set of lines. So I guess one way would be to sort the line parts, so that the cursor goes through the line as I want. The second would be creating some on/route events. The second one I have not checked yet, but I have failed so far with the sorting.

my advice would be to investigate Linear Referencing:

Linear referencing is the method of storing geographic locations by using relative positions along a measured linear feature. Distance measures are used to locate events along the line

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.