diff --git a/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py b/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py index 22480581072..11721c97d18 100644 --- a/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py +++ b/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py @@ -209,7 +209,7 @@ class ServiceAreaFromLayer(QgisAlgorithm): multiplier * 1000.0 / 3600.0) director.addStrategy(strategy) - builder = QgsGraphBuilder(context.project().crs(), + builder = QgsGraphBuilder(network.sourceCrs(), True, tolerance) diff --git a/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py b/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py index b2473b06ebe..a9926696a1f 100644 --- a/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py +++ b/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py @@ -200,7 +200,7 @@ class ServiceAreaFromPoint(QgisAlgorithm): multiplier * 1000.0 / 3600.0) director.addStrategy(strategy) - builder = QgsGraphBuilder(context.project().crs(), + builder = QgsGraphBuilder(network.sourceCrs(), True, tolerance) feedback.pushInfo(self.tr('Building graph...')) diff --git a/python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py b/python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py index 62745deb66e..839732c12c0 100644 --- a/python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py +++ b/python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py @@ -207,7 +207,7 @@ class ShortestPathLayerToPoint(QgisAlgorithm): multiplier = 3600 director.addStrategy(strategy) - builder = QgsGraphBuilder(context.project().crs(), + builder = QgsGraphBuilder(network.sourceCrs(), True, tolerance) @@ -237,7 +237,7 @@ class ShortestPathLayerToPoint(QgisAlgorithm): nPoints = len(snappedPoints) total = 100.0 / nPoints if nPoints else 1 - for i in range(1, count + 1): + for i in range(1, nPoints + 1): if feedback.isCanceled(): break diff --git a/python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py b/python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py index b9d193ee094..434d51c7826 100644 --- a/python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py +++ b/python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py @@ -36,6 +36,7 @@ from qgis.core import (QgsWkbTypes, QgsFeature, QgsFeatureSink, QgsGeometry, + QgsFeatureRequest, QgsFields, QgsField, QgsMessageLog, @@ -206,7 +207,7 @@ class ShortestPathPointToLayer(QgisAlgorithm): multiplier = 3600 director.addStrategy(strategy) - builder = QgsGraphBuilder(context.project().crs(), + builder = QgsGraphBuilder(network.sourceCrs(), True, tolerance) @@ -237,7 +238,7 @@ class ShortestPathPointToLayer(QgisAlgorithm): nPoints = len(snappedPoints) total = 100.0 / nPoints if nPoints else 1 - for i in range(1, count + 1): + for i in range(1, nPoints + 1): if feedback.isCanceled(): break diff --git a/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py b/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py index a942808d13d..16345a177d9 100644 --- a/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py +++ b/python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py @@ -206,7 +206,7 @@ class ShortestPathPointToPoint(QgisAlgorithm): multiplier = 3600 director.addStrategy(strategy) - builder = QgsGraphBuilder(context.project().crs(), + builder = QgsGraphBuilder(network.sourceCrs(), True, tolerance) feedback.pushInfo(self.tr('Building graph...'))