QGIS – Finding and Analyzing Disconnected Islands in a Road Network Layer

network analysisqgisqgis-pluginsqgis-processing

I have a road network layer that can't route from one side of the layer to the other. Topologically, there is no connectivity between the start and end nodes, probably due to missing links. This creates disconnected "islands" in the network graph.

How can I use QGIS or a python plugin to analyse my road network, perhaps traversing it from the starting node, to the extents of the connected links?

The output can either be a group column, where all connected links will all have the same ID, and the number of distinct IDs will be the number of disconnected islands, or a colour coded equivalent, like the one below, produced by TransCAD.

Image showing disconnected regions in different colours

I am using QGIS 2.14.0-Essen. I have tried Topology Checker, Processing modules (formerly Sextante toolbox), GRASS v.net, v.clean, etc, and PyQGIS Developer Cookbook (http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/network_analysis.html#areas-of-availability)

The next step is to try and iterate, from the starting node, all "touching" links, adding them to a selection set, until there are no further ones to add. Label these as group 1 and then move onto another link that has not been selected and repeat for group 2, and so on, until there are no more unselected links.

Other tools, like ArcGIS, have a "Find Disconnected" tool but I am looking for a QGIS solution.

Best Answer

Based on Detlev's answer, I have developed a QGIS plugin which should allow others to solve similar problems easily. It is available in the official QGIS plugins repository and can be found in the QGIS menu: Plugins / Manage and Install Plugins... and search for Disconnected Islands.

http://plugins.qgis.org/plugins/disconnected-islands/

This plugin runs on a line layer, building up a road (or rail, etc.) network graph of connected links. It then analyses connected subgraphs, ones that are connected to each other, but not connected to isolated or floating links. It creates an additional attribute containing the group ID of the subgraph. This can then be used to style the layer with Categorised styles, or Zoom to selection. The disconnected links can then be fixed.

Sample data to test this plugin can be found in your plugins directory: ~/.qgis2/python/plugins/disconnected-islands/sample-data/islands.zip

Source code can be forked from: https://github.com/AfriGIS-South-Africa/disconnected-islands

Related Question