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)

elena_grigoreva
  • 315
  • 2
  • 11
  • As per the [Tour] there should be only one question per question. – PolyGeo Dec 08 '15 at 01:07
  • Are your lines single part polylines? – FelixIP Dec 08 '15 at 01:30
  • I have dissolved the line with unsplit line, but I am not sure, what you mean. – elena_grigoreva Dec 08 '15 at 01:44
  • @elena_grigoreva Run add geometry attributes and pick part count. If lines have more than 1 part, no tools will work. Each line must have only 2 'end' points, or to be more precise 1 start point and 1 end point – FelixIP Dec 08 '15 at 01:54
  • @FelixIP thank you! it indeed has not one, but 24 parts. Now I know, what to fix first. – elena_grigoreva Dec 08 '15 at 03:03
  • 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 08 '15 at 07: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 https://geonet.esri.com/blogs/richard_fairhurst/2015/06/07/mmontoniticy-calculation-how-to-tell-if-your-route-is-simple-or-complex 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 08 '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 08 '15 at 20:25
  • @PauloRaposo how could I sort it? I saw in the editor that the sequence of parts is rather disorganized, but I am not sure,how could I access and change it. – elena_grigoreva Dec 08 '15 at 22:05
  • @RichardFairhurst 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. – elena_grigoreva Dec 08 '15 at 22:12
  • 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 08 '15 at 22:29
  • @RichardFairhurst it sounds very logical, is a bit off topic though. My initial task was to import public transport routes, which are stored in osm files as relations. I have not found a way to put them better as a single polyline, because in the end I do not need the routes themselves,but just the created points on them. – elena_grigoreva Dec 08 '15 at 22:40
  • 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 08 '15 at 23:11
  • @RichardFairhurst ok, now I get what you are saying. If you could point me to how to do this isolation (to some post) I would highly appreciate it. – elena_grigoreva Dec 08 '15 at 23:32
  • I think this is a Linear Referencing problem rather than one for ArcPy cursors or Network Analyst. Linear Referencing is available in the core product i.e. needs no licensing of Network Analyst or any other extension. – PolyGeo Dec 14 '15 at 10:22

1 Answers1

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

PolyGeo
  • 65,136
  • 29
  • 109
  • 338