Skip to content

Commit

Permalink
Long-awaited fix for NetworkX upgrade from v1 to v2, still for QGIS v2.x
Browse files Browse the repository at this point in the history
Fix for NetworkX upgrade from v1 to v2
Replace edges_iter with edges
ref: https://networkx.github.io/documentation/stable/release/migration_guide_from_1.x_to_2.0.html

Updated metadata to v1.0.4
  • Loading branch information
petersmythe committed Nov 23, 2018
2 parents 72abe3e + 3c07464 commit 70f2ef8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions disconnected_islands.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@


#import networkx as nx
from PyQt4.QtCore import *
from qgis.core import * #QgsMapLayerRegistry, QgsVectorDataProvider, QgsField
from PyQt4.QtCore import Qt
from qgis.core import QgsMapLayerRegistry, QgsVectorDataProvider, QgsField, QgsSymbolV2, QgsRendererCategoryV2, QgsCategorizedSymbolRendererV2
from qgis.gui import QgsMessageBar
from PyQt4.QtGui import QProgressBar, QColor
from PyQt4 import QtGui
Expand Down Expand Up @@ -315,9 +315,9 @@ def run(self):
# gather edges and components to which they belong
fid_comp = {}
for i, graph in enumerate(connected_components):
for edge in graph.edges_iter(data=True):
for edge in graph.edges(data=True):
fid_comp[edge[2].get('fid', None)] = i

# write output to csv file
#with open('C:/Tmp/Components.csv', 'wb') as f:
# w = csv.DictWriter(f, fieldnames=['fid', 'group'])
Expand Down
6 changes: 4 additions & 2 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
name=Disconnected Islands
qgisMinimumVersion=2.0
description=Finds disconnected "islands" in a transport network layer, so that a routing tool will work between all nodes. A tolerance field allows for imperfect topology.
version=1.0.3
version=1.0.4
author=Peter Smythe @ AfriGIS
[email protected]

Expand All @@ -29,7 +29,9 @@ repository=https://github.com/AfriGIS-South-Africa/disconnected-islands.git
# Recommended items:

# Uncomment the following line and add your changelog:
changelog=Version 1.0.3 (2016-04-11)
changelog=Version 1.0.4 (2018-11-23)
- Fix for NetworkX upgrade from v1 to v2<br/>
Version 1.0.3 (2016-04-11)
- handle error for ESRI Shapefile if attribute name is larger than 10 characters
- add general exception handling
- compress sample data into a single ZIP file for easy direct download from GitHub<br/>
Expand Down

0 comments on commit 70f2ef8

Please sign in to comment.