2

I have one shapefile with train stations (points) from a region in the UK and another shapefile with railroad tracks (lines) between these stations. Problem is, in the latter I don't have a unique line from one station to the next, but multiple connected segments. The only thing that I was able to do was to add another shapefile with junction points, to just visualize where the segment endpoints are.

How can I merge these multiple lines together, so that from station A to station B there is only one line? This is intended to be repeated for any pair of connected stations.

I would also be keen on using Python to do this, making sure there is a way for me to tell the script to merge all the lines between two stations, ignoring the junction points.

I have already tried both Unsplit lines and Dissolve, but the resulting lines are longer than they should be, e.g. they incorporate one too many segments, thus going past their intended endpoint. Unsplit lines seems to be the closest match, but I'd need to be able to restrict the merging so that it is only performed when junction points stand in the way (see image below), thus stopping at station points. If someone came up with a manual procedure, that'd be ok as well, as my dataset is not massive and I could handle it.

For purposes of clarity, see the image below. Currently, I have a number of segments and junction points in between two consecutive stations. The desired output is, instead, a unique object (line) connecting the two stations. enter image description here

EDIT

Dissolve does not work as the segments composing the A-to-B route do not share any common field value.

  • 1
    Which specific questions similar to this did you find and why precisely did their answers not work for you when you tried/considered them? – PolyGeo May 22 '16 at 21:15
  • 1
    I suspect the answer is to use the tool from linear referencing that overlays linear events but the inclusion of a picture to illustrate your requirement would make that determination easier. – PolyGeo May 22 '16 at 21:22
  • 2
    Does the segment from Station A to the junction need to be duplicated to connect to not only Station B but also to Stations C and/or D that tie to the same junction? Is that why you cannot attribute the segments to just involve the segments that join one station to the next without unneeded segments getting involved as well? Anyway, you may need Network Analyst to create all possible shortest routes between all possible connected stations. – Richard Fairhurst May 22 '16 at 21:22
  • This is geometric network or network analyst exercise. Create points at the ends of all segments, remove duplicates. Assign from and to node to segments. Trace between 2 pairs rail stations, and populate unique field for selected segments. Dissolve segments later using this field – FelixIP May 22 '16 at 21:46
  • @FelixIP yes, that is the conceptual idea. But how to put it into practice? This question should clarify the "unique field" aspect: gis.stackexchange.com/questions/194536/… – FaCoffee May 23 '16 at 11:04
1

This would be a two or three step process. First dissolve all lines into a single feature (do not indicate a dissolve field). Next, split lines at points using your station feature class as the point input. You may then need to perform a multipart to singlepart as a final step.

1

This is comment, but comments box is too small.

Are you able to make end points and delete spatial duplicates? The answer should be yes, because ArcGis has this tools.

Are you able to assign nodes IDs to lines? Answer should be yes, there are multiple posts, e.g. Assign point IDs to respective start and end attributes of a polyline

Thus your question should be "how to trace links between 2 nodes" in indirected network? "

I guess you can find solutions on this site or exploring relevant arcgis tools. If no avail I can post script I am using

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.