I have a large road network that I'm using for routing and agent-based modelling and I've just noticed that it has a lot (possibly hundreds) of road segments that are not connected to the full network. I think this was because the road network was clipped to fit a county line that was a bit wiggly. My agent-based model places agents on road segments at random and when it places them on unattached road segments it fails.

Is there a way to highlight and remove all unattached road segments using QGIS or ArcGIS?

I've done some Googling and found info on 'dangles' but I've not been able to get the job done.

enter image description here

  • There have been posted several solutions for ArcGIS: gis.stackexchange.com/questions/92147/… or gis.stackexchange.com/questions/109378/… Commented Feb 16, 2016 at 10:59
  • 1
    Asking for solutions in two different products is going to generate two sets of potential answers. It is policy here to ask one question per Question. Please edit your question to choose one GIS package. You can research results for a different package in a different question.
    – Vince
    Commented Feb 16, 2016 at 12:51

3 Answers 3


For QGIS, you could try the steps below. I used QGIS 2.12.3-Lyon and have a "road" line shapefile, the isolated road in the red circle is what we're trying to remove.

Unconnected road

  1. Intersect your layer on itself (Vector > Geoprocessing Tools > Intersect):


  2. Load the Spatial Query plugin (you may need to download/install this from Plugins > Manage and Install Plugins):

    Spatial Query

  3. Set the parameters for the Spatial Query to have your original line layer touch the intersected layer:

    Spatial Query options

  4. Run the plugin and when it's done, select the button to "Create layer with list of items":

    Results from Spatial Query

  5. The newly created layer should no longer have the isolated road.

    Final results


you could use "generate near table" with a small search radius. Values of -1 would mean that your road is far away from the network and should be removed. Values > 0 would mean that the road segment is not connect but that this could be automatically corrected by some edits/snapping tool.


I've no experience with QGIS or other GIS software but we automatically remove smaller 'islands' from the road network in GraphHopper via subnetwork detection.

It uses the tarjan algorithm, maybe you can apply that for QGIS somehow. Keep in mind that bad connectivity does not just mean missing arcs but could also mean that an island is connected and reachable but you cannot get out of the 'island' as there is only one 'bridge' and this is an oneway.

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