My script to compute distance in my network works. Now I want to loop over all features of a point layer to produce multiple distance calculations.
Just iterating over the features work of course and prints all of them correctly. When I add the rest of the script QGIS shuts down immediately after the first iteration, but I am not able to recover an error message.
for f in points_layer.getFeatures(): points_to_tie = [QgsPoint(f['longitudeO'], f['latitudeOr']), QgsPoint(f['longitudeD'], f['latitudeDe'])] #PROGRESS: #count += 1 #print "calculating number %s" % count tiedPoints = director.makeGraph(builder, points_to_tie) graph = builder.graph() startId = graph.findVertex(tiedPoints) endId = graph.findVertex(tiedPoints[-1]) (dtree, dcost) = QgsGraphAnalyzer.dijkstra(graph, startId, 0) print "Travel time from %s to %s is %s hours" % (f['municipOri'], f['municipDes'], dcost[endId]) del graph del tiedPoints del points_to_tie del startId del endId del dtree del dcost
I thought this question was a good hint, but it doesn't solve it when I delete everything at the end of the loop.
Is there an obvious mistake that I am making?