4

I am using a road map in shapefile format in order to calculate a route between two points. The map is downloaded from OpenStreetMap and it has small unconnected lines that are messing up my routing.

Is there any way that I could get rid of those without having to manually remove them one by one? The lines look like this: http://screencast.com/t/4jnQFx57

3
  • Generally speaking if you have a graph then isolated arcs can be found easily because both the start and end nodes have cardinality of 1. However, I have no experience on routing with QGIS.
    – user30184
    Commented Aug 27, 2014 at 14:55
  • These lines shouldn't mess up your routing unless you start or finish on one. And if you delete them then where are you going to start or finish your route?
    – Spacedman
    Commented Sep 1, 2014 at 8:25
  • Indeed that is the problem, my algorithm looks for the closest graph node from the start point and then iterates through the graph.If it finds an unconnected line it throws a no road found error. That is what i am trying to fix Commented Sep 1, 2014 at 8:42

2 Answers 2

2

You could calculate a buffer (not more than 5 meters) for the start- and endpoint of every linestring. Then, intersect the buffer with the road network. A line that doesn't intersect with the buffer is likely to be a "correct" unconnected road. However, you'll have to play with the buffer radius for satisfactory results.

1
  • Yeah, basically i have found a solution that will do something like this. I will take the start point and the end point of the linestring and if i find one of them in the others multi-linestrings that will mean the line is connected Commented Sep 1, 2014 at 8:45
0

Perhaps use the Spatial Query to select all lines that intersect or touch or overlap other lines. Then could you invert the selection (to select all lines that do not intersect, touch or overlap) and delete the lines?

Perhaps the topology checker could work to help you select or identify lines not touching other lines.

1
  • thanks! unfortunately both those methods are not working in my case Commented Aug 29, 2014 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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