I have a road layer, with two locations points. I have created a shortest path analysis between these points.

enter image description here

Now, I would like to delete some segment from the road network. I would like to delete (some) segments that the shortest path (displayed in bright red) lies on. Once this lines are deleted, I want to run the shortest path again.I want to do this in order to have two "shortest" paths that I can compare later on.

I have tried to create a multistring, then edit, select segment and delete. However, the segments remain in the layer.

How can delete segments, so my second shortest path analysis run through a different route?

  • Cut at both ends and delete.
    – user30184
    Dec 3 '17 at 14:18
  • but i only want to delete part of the segment, as the second half of the route will be the same.
    – user1607
    Dec 3 '17 at 15:09
  • What I meant is like how you would do it with the scissors. Cut the line at both ends of the section that you want to remove and then delete the middle section. If you had a line A-B, you will first have a line A-C-D-B with two new vertices, and finally two non-connected line A-C and D-B.
    – user30184
    Dec 3 '17 at 15:46

OK, I have been over thinking things when I posted the question. Removing segments from a road networks is much easier than that.

Road Network segment removal:

  1. Select the road network layer in the layers panel
  2. choose select features by polygon in the top menu bar
  3. select all parts of the network you want be removed. Be careful, some streets might extend outside of the polygon once selected and you might removed something you did not intent to remove.
  4. Go to attribute table. Invert Selection.
  5. Right click on the road network layer in the layer panel and save as.... Under encoding, tick the box Save only selected features.

Shortest Path Analysis re-calculation:

  1. Go to Vector|Road Graph|Settings and change the transportation layer to the layer you have saved in step 5.

  2. Re-calculate

Thats it. The final output looks like. There is some potential form improvement arount the location point Geo Institute, but this is good enough for illustration purposes.

enter image description here


The method you tried won't work because it's still the same single feature, even if you add/remove vertices. You need to first split the feature you're trying to modify, then delete the segment(s) that you no longer want included in the path analysis. See my previous answer on splitting features using the advanced digitizing tools to do this.

  • thanks for your input, but the method i tried worked well for me and did exactly what i wanted to be done.
    – user1607
    Feb 7 '18 at 19:02

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.