Skip to content
Permalink
Browse files

Merge pull request #5919 from nyalldawson/iter_datum

Use transform context in feature requests with destination crs set
  • Loading branch information
nyalldawson committed Dec 20, 2017
2 parents bf85709 + 4643712 commit 3c7f7454245d63ecd04f092a5c698becf1a233dc
Showing with 242 additions and 187 deletions.
  1. +2 −1 doc/api_break.dox
  2. +20 −0 python/core/processing/qgsprocessingcontext.sip
  3. +2 −2 python/core/qgsdistancearea.sip
  4. +15 −1 python/core/qgsfeaturerequest.sip
  5. +0 −1 python/gui/qgsattributeeditorcontext.sip
  6. +1 −1 python/plugins/processing/algs/qgis/Aggregate.py
  7. +2 −2 python/plugins/processing/algs/qgis/Difference.py
  8. +1 −1 python/plugins/processing/algs/qgis/ExportGeometryInfo.py
  9. +1 −1 python/plugins/processing/algs/qgis/FieldsCalculator.py
  10. +1 −1 python/plugins/processing/algs/qgis/FieldsMapper.py
  11. +3 −3 python/plugins/processing/algs/qgis/HubDistanceLines.py
  12. +3 −3 python/plugins/processing/algs/qgis/HubDistancePoints.py
  13. +1 −1 python/plugins/processing/algs/qgis/HypsometricCurves.py
  14. +2 −2 python/plugins/processing/algs/qgis/Intersection.py
  15. +1 −1 python/plugins/processing/algs/qgis/NearestNeighbourAnalysis.py
  16. +7 −7 python/plugins/processing/algs/qgis/PointDistance.py
  17. +1 −1 python/plugins/processing/algs/qgis/PointsFromLines.py
  18. +1 −1 python/plugins/processing/algs/qgis/PointsFromPolygons.py
  19. +2 −2 python/plugins/processing/algs/qgis/PointsInPolygon.py
  20. +1 −1 python/plugins/processing/algs/qgis/PointsToPaths.py
  21. +1 −1 python/plugins/processing/algs/qgis/RandomPointsAlongLines.py
  22. +1 −1 python/plugins/processing/algs/qgis/RandomPointsPolygons.py
  23. +1 −1 python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py
  24. +1 −1 python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py
  25. +1 −1 python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py
  26. +1 −1 python/plugins/processing/algs/qgis/SpatialJoin.py
  27. +1 −1 python/plugins/processing/algs/qgis/SpatialJoinSummary.py
  28. +3 −3 python/plugins/processing/algs/qgis/SumLines.py
  29. +3 −3 python/plugins/processing/algs/qgis/SymmetricalDifference.py
  30. +4 −4 python/plugins/processing/algs/qgis/Union.py
  31. +2 −2 src/3d/symbols/qgsline3dsymbol_p.cpp
  32. +4 −4 src/3d/symbols/qgspoint3dsymbol_p.cpp
  33. +2 −2 src/3d/symbols/qgspolygon3dsymbol_p.cpp
  34. +2 −1 src/analysis/network/qgsgraphbuilderinterface.h
  35. +1 −1 src/analysis/processing/qgsalgorithmclip.cpp
  36. +4 −4 src/analysis/processing/qgsalgorithmextractbylocation.cpp
  37. +1 −1 src/analysis/processing/qgsalgorithmextractbylocation.h
  38. +1 −1 src/analysis/processing/qgsalgorithmjoinwithlines.cpp
  39. +2 −2 src/analysis/processing/qgsalgorithmlineintersection.cpp
  40. +1 −1 src/analysis/processing/qgsalgorithmmergevector.cpp
  41. +1 −1 src/analysis/processing/qgsalgorithmsplitwithlines.cpp
  42. +1 −1 src/app/qgisapp.cpp
  43. +1 −1 src/app/qgisappinterface.cpp
  44. +1 −1 src/app/qgsattributeactionpropertiesdialog.cpp
  45. +3 −3 src/app/qgsattributetabledialog.cpp
  46. +2 −2 src/app/qgsdiagramproperties.cpp
  47. +1 −1 src/app/qgsfeatureaction.cpp
  48. +2 −2 src/app/qgsfieldcalculator.cpp
  49. +1 −1 src/app/qgslabelinggui.cpp
  50. +1 −1 src/app/qgsmaptoolmeasureangle.cpp
  51. +1 −1 src/app/qgsmaptooloffsetpointsymbol.cpp
  52. +1 −1 src/app/qgsmeasuredialog.cpp
  53. +2 −2 src/core/composer/qgscomposerhtml.cpp
  54. +2 −2 src/core/composer/qgscomposerlabel.cpp
  55. +1 −1 src/core/composer/qgscomposerscalebar.cpp
  56. +1 −1 src/core/layout/qgslayoutitemhtml.cpp
  57. +1 −1 src/core/layout/qgslayoutitemlabel.cpp
  58. +1 −1 src/core/layout/qgslayoutitemscalebar.cpp
  59. +28 −1 src/core/processing/qgsprocessingcontext.h
  60. +1 −3 src/core/providers/memory/qgsmemoryfeatureiterator.cpp
  61. +2 −6 src/core/qgscachedfeatureiterator.cpp
  62. +4 −2 src/core/qgsdistancearea.cpp
  63. +2 −2 src/core/qgsdistancearea.h
  64. +7 −1 src/core/qgsfeaturerequest.cpp
  65. +12 −1 src/core/qgsfeaturerequest.h
  66. +1 −1 src/core/qgsrendercontext.cpp
  67. +3 −5 src/core/qgsvectorlayerfeatureiterator.cpp
  68. +3 −5 src/core/qgsvectorlayerlabelprovider.cpp
  69. +2 −2 src/gui/qgsattributeeditorcontext.h
  70. +1 −1 src/gui/qgsmaptoolidentify.cpp
  71. +1 −3 src/providers/arcgisrest/qgsafsfeatureiterator.cpp
  72. +1 −3 src/providers/db2/qgsdb2featureiterator.cpp
  73. +1 −3 src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp
  74. +1 −3 src/providers/gpx/qgsgpxfeatureiterator.cpp
  75. +1 −3 src/providers/mssql/qgsmssqlfeatureiterator.cpp
  76. +1 −3 src/providers/ogr/qgsogrfeatureiterator.cpp
  77. +1 −1 src/providers/oracle/qgsoraclefeatureiterator.cpp
  78. +1 −3 src/providers/postgres/qgspostgresfeatureiterator.cpp
  79. +1 −3 src/providers/spatialite/qgsspatialitefeatureiterator.cpp
  80. +1 −3 src/providers/virtual/qgsvirtuallayerfeatureiterator.cpp
  81. +1 −3 src/providers/wfs/qgswfsfeatureiterator.cpp
  82. +11 −10 tests/src/core/testqgsdistancearea.cpp
  83. +1 −1 tests/src/core/testqgsexpression.cpp
  84. +4 −3 tests/src/python/featuresourcetestbase.py
  85. +15 −15 tests/src/python/test_qgsdistancearea.py
  86. +2 −1 tests/src/python/test_qgsfeaturesource.py
  87. +3 −2 tests/src/python/test_qgsrendercontext.py
  88. +1 −1 tests/src/python/test_qgsvectorlayer.py
@@ -1128,7 +1128,8 @@ ellipsoid to 'NONE' to disable ellipsoidal calculations.
- ellipsoidalEnabled() was removed. Ellipsoidal calculations are now enabled whenever a valid ellipsoid() is set. Check
willUseEllipsoid() to determine whether ellipsoidal calculations will be performed.
- sourceCrs() now returns a QgsCoordinateReferenceSystem instead of the crs ID.
- setSourceCrs() now requires a QgsCoordinateReferenceSystem instead of crs ID.
- setSourceCrs() now requires a QgsCoordinateReferenceSystem instead of crs ID, and requires a QgsCoordinateTransformContext object. PyQGIS code
can use QgsProject.instance().transformContext() for the QgsCoordinateTransformContext argument.
- setSourceAuthId() was removed. Use setSourceCrs() instead.
- geographic() was removed. Check sourceCrs().isGeographic() instead.
- measure() has been removed. Use measureArea() or measureLength() instead.
@@ -70,6 +70,9 @@ Returns the project in which the algorithm is being executed.
%Docstring
Sets the ``project`` in which the algorithm will be executed.

This also automatically sets the transformContext() to match
the project's transform context.

.. seealso:: :py:func:`project()`
%End

@@ -82,6 +85,23 @@ Returns the expression context.
void setExpressionContext( const QgsExpressionContext &context );
%Docstring
Sets the expression ``context``.
%End

QgsCoordinateTransformContext transformContext() const;
%Docstring
Returns the coordinate transform context.

.. seealso:: :py:func:`setTransformContext()`
%End

void setTransformContext( const QgsCoordinateTransformContext &context );
%Docstring
Sets the coordinate transform ``context``.

Note that setting a project for the context will automatically set the coordinate transform
context.

.. seealso:: :py:func:`transformContext()`
%End

QgsMapLayerStore *temporaryLayerStore();
@@ -50,9 +50,9 @@ ellipsoid if a valid ellipsoid() has been set.
.. seealso:: :py:func:`ellipsoid()`
%End

void setSourceCrs( const QgsCoordinateReferenceSystem &srcCRS );
void setSourceCrs( const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context );
%Docstring
Sets source spatial reference system.
Sets source spatial reference system ``crs``.

.. versionadded:: 2.2

@@ -549,10 +549,24 @@ and all features will be left with their original geometry.

.. seealso:: :py:func:`setDestinationCrs()`

.. seealso:: :py:func:`transformContext()`

.. versionadded:: 3.0
%End

QgsCoordinateTransformContext transformContext() const;
%Docstring
Returns the transform context, for use when a destinationCrs() has been set
and reprojection is required

.. seealso:: :py:func:`setDestinationCrs()`

.. seealso:: :py:func:`destinationCrs()`

.. versionadded:: 3.0
%End

QgsFeatureRequest &setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
QgsFeatureRequest &setDestinationCrs( const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context );
%Docstring
Sets the destination ``crs`` for feature's geometries. If set, all
geometries will be reprojected from their original coordinate reference
@@ -10,7 +10,6 @@




class QgsAttributeEditorContext
{
%Docstring
@@ -135,7 +135,7 @@ def prepareAlgorithm(self, parameters, context, feedback):
aggregates = self.parameterAsAggregates(parameters, self.AGGREGATES, context)

da = QgsDistanceArea()
da.setSourceCrs(source.sourceCrs())
da.setSourceCrs(source.sourceCrs(), context.transformContext())
da.setEllipsoid(context.project().ellipsoid())

self.source = source
@@ -86,7 +86,7 @@ def processAlgorithm(self, parameters, context, feedback):
featB = QgsFeature()
outFeat = QgsFeature()

indexB = QgsSpatialIndex(sourceB.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(sourceA.sourceCrs())), feedback)
indexB = QgsSpatialIndex(sourceB.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(sourceA.sourceCrs(), context.transformContext())), feedback)

total = 100.0 / (sourceA.featureCount() * sourceB.featureCount()) if sourceA.featureCount() and sourceB.featureCount() else 1
count = 0
@@ -101,7 +101,7 @@ def processAlgorithm(self, parameters, context, feedback):
attrs = featA.attributes()
intersects = indexB.intersects(geom.boundingBox())
request = QgsFeatureRequest().setFilterFids(intersects).setSubsetOfAttributes([])
request.setDestinationCrs(sourceA.sourceCrs())
request.setDestinationCrs(sourceA.sourceCrs(), context.transformContext())
for featB in sourceB.getFeatures(request):
if feedback.isCanceled():
break
@@ -123,7 +123,7 @@ def processAlgorithm(self, parameters, context, feedback):

self.distance_area = QgsDistanceArea()
if method == 2:
self.distance_area.setSourceCrs(source.sourceCrs())
self.distance_area.setSourceCrs(source.sourceCrs(), context.transformContext())
self.distance_area.setEllipsoid(context.project().ellipsoid())
elif method == 1:
coordTransform = QgsCoordinateTransform(source.sourceCrs(), context.project().crs(), context.project())
@@ -104,7 +104,7 @@ def processAlgorithm(self, parameters, context, feedback):

expression = QgsExpression(formula)
da = QgsDistanceArea()
da.setSourceCrs(source.sourceCrs())
da.setSourceCrs(source.sourceCrs(), context.transformContext())
da.setEllipsoid(context.project().ellipsoid())
expression.setGeomCalculator(da)

@@ -121,7 +121,7 @@ def prepareAlgorithm(self, parameters, context, feedback):
self.expressions = []

da = QgsDistanceArea()
da.setSourceCrs(source.sourceCrs())
da.setSourceCrs(source.sourceCrs(), context.transformContext())
da.setEllipsoid(context.project().ellipsoid())

# create an expression context using thread safe processing context
@@ -114,10 +114,10 @@ def processAlgorithm(self, parameters, context, feedback):
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, QgsWkbTypes.LineString, point_source.sourceCrs())

index = QgsSpatialIndex(hub_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(point_source.sourceCrs())))
index = QgsSpatialIndex(hub_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(point_source.sourceCrs(), context.transformContext())))

distance = QgsDistanceArea()
distance.setSourceCrs(point_source.sourceCrs())
distance.setSourceCrs(point_source.sourceCrs(), context.transformContext())
distance.setEllipsoid(context.project().ellipsoid())

# Scan source points, find nearest hub, and write to output file
@@ -133,7 +133,7 @@ def processAlgorithm(self, parameters, context, feedback):
src = f.geometry().boundingBox().center()

neighbors = index.nearestNeighbor(src, 1)
ft = next(hub_source.getFeatures(QgsFeatureRequest().setFilterFid(neighbors[0]).setSubsetOfAttributes([fieldName], hub_source.fields()).setDestinationCrs(point_source.sourceCrs())))
ft = next(hub_source.getFeatures(QgsFeatureRequest().setFilterFid(neighbors[0]).setSubsetOfAttributes([fieldName], hub_source.fields()).setDestinationCrs(point_source.sourceCrs(), context.transformContext())))
closest = ft.geometry().boundingBox().center()
hubDist = distance.measureLine(src, closest)

@@ -110,10 +110,10 @@ def processAlgorithm(self, parameters, context, feedback):
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, QgsWkbTypes.Point, point_source.sourceCrs())

index = QgsSpatialIndex(hub_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(point_source.sourceCrs())))
index = QgsSpatialIndex(hub_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(point_source.sourceCrs(), context.transformContext())))

distance = QgsDistanceArea()
distance.setSourceCrs(point_source.sourceCrs())
distance.setSourceCrs(point_source.sourceCrs(), context.transformContext())
distance.setEllipsoid(context.project().ellipsoid())

# Scan source points, find nearest hub, and write to output file
@@ -130,7 +130,7 @@ def processAlgorithm(self, parameters, context, feedback):
src = f.geometry().boundingBox().center()

neighbors = index.nearestNeighbor(src, 1)
ft = next(hub_source.getFeatures(QgsFeatureRequest().setFilterFid(neighbors[0]).setSubsetOfAttributes([fieldName], hub_source.fields()).setDestinationCrs(point_source.sourceCrs())))
ft = next(hub_source.getFeatures(QgsFeatureRequest().setFilterFid(neighbors[0]).setSubsetOfAttributes([fieldName], hub_source.fields()).setDestinationCrs(point_source.sourceCrs(), context.transformContext())))
closest = ft.geometry().boundingBox().center()
hubDist = distance.measureLine(src, closest)

@@ -114,7 +114,7 @@ def processAlgorithm(self, parameters, context, feedback):
memVectorDriver = ogr.GetDriverByName('Memory')
memRasterDriver = gdal.GetDriverByName('MEM')

features = source.getFeatures(QgsFeatureRequest().setDestinationCrs(target_crs))
features = source.getFeatures(QgsFeatureRequest().setDestinationCrs(target_crs, context.transformContext()))
total = 100.0 / source.featureCount() if source.featureCount() else 0

for current, f in enumerate(features):
@@ -132,7 +132,7 @@ def processAlgorithm(self, parameters, context, feedback):
output_fields, geomType, sourceA.sourceCrs())

outFeat = QgsFeature()
indexB = QgsSpatialIndex(sourceB.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(sourceA.sourceCrs())), feedback)
indexB = QgsSpatialIndex(sourceB.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(sourceA.sourceCrs(), context.transformContext())), feedback)

total = 100.0 / sourceA.featureCount() if sourceA.featureCount() else 1
count = 0
@@ -149,7 +149,7 @@ def processAlgorithm(self, parameters, context, feedback):
intersects = indexB.intersects(geom.boundingBox())

request = QgsFeatureRequest().setFilterFids(intersects)
request.setDestinationCrs(sourceA.sourceCrs())
request.setDestinationCrs(sourceA.sourceCrs(), context.transformContext())
request.setSubsetOfAttributes(field_indices_b)

engine = None
@@ -98,7 +98,7 @@ def processAlgorithm(self, parameters, context, feedback):
spatialIndex = QgsSpatialIndex(source, feedback)

distance = QgsDistanceArea()
distance.setSourceCrs(source.sourceCrs())
distance.setSourceCrs(source.sourceCrs(), context.transformContext())
distance.setEllipsoid(context.project().ellipsoid())

sumDist = 0.00
@@ -154,10 +154,10 @@ def linearMatrix(self, parameters, context, source, inField, target_source, targ
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, out_wkb, source.sourceCrs())

index = QgsSpatialIndex(target_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(source.sourceCrs())), feedback)
index = QgsSpatialIndex(target_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(source.sourceCrs(), context.transformContext())), feedback)

distArea = QgsDistanceArea()
distArea.setSourceCrs(source.sourceCrs())
distArea.setSourceCrs(source.sourceCrs(), context.transformContext())
distArea.setEllipsoid(context.project().ellipsoid())

features = source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([inIdx]))
@@ -171,7 +171,7 @@ def linearMatrix(self, parameters, context, source, inField, target_source, targ
featList = index.nearestNeighbor(inGeom.asPoint(), nPoints)
distList = []
vari = 0.0
request = QgsFeatureRequest().setFilterFids(featList).setSubsetOfAttributes([outIdx]).setDestinationCrs(source.sourceCrs())
request = QgsFeatureRequest().setFilterFids(featList).setSubsetOfAttributes([outIdx]).setDestinationCrs(source.sourceCrs(), context.transformContext())
for outFeat in target_source.getFeatures(request):
if feedback.isCanceled():
break
@@ -208,13 +208,13 @@ def linearMatrix(self, parameters, context, source, inField, target_source, targ
def regularMatrix(self, parameters, context, source, inField, target_source, targetField,
nPoints, feedback):
distArea = QgsDistanceArea()
distArea.setSourceCrs(source.sourceCrs())
distArea.setSourceCrs(source.sourceCrs(), context.transformContext())
distArea.setEllipsoid(context.project().ellipsoid())

inIdx = source.fields().lookupField(inField)
targetIdx = target_source.fields().lookupField(targetField)

index = QgsSpatialIndex(target_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(source.sourceCrs())), feedback)
index = QgsSpatialIndex(target_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(source.sourceCrs(), context.transformContext())), feedback)

first = True
sink = None
@@ -233,14 +233,14 @@ def regularMatrix(self, parameters, context, source, inField, target_source, tar
input_id_field = source.fields()[inIdx]
input_id_field.setName('ID')
fields.append(input_id_field)
for f in target_source.getFeatures(QgsFeatureRequest().setFilterFids(featList).setSubsetOfAttributes([targetIdx]).setDestinationCrs(source.sourceCrs())):
for f in target_source.getFeatures(QgsFeatureRequest().setFilterFids(featList).setSubsetOfAttributes([targetIdx]).setDestinationCrs(source.sourceCrs(), context.transformContext())):
fields.append(QgsField(str(f[targetField]), QVariant.Double))

(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, source.wkbType(), source.sourceCrs())

data = [inFeat[inField]]
for target in target_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setFilterFids(featList).setDestinationCrs(source.sourceCrs())):
for target in target_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setFilterFids(featList).setDestinationCrs(source.sourceCrs(), context.transformContext())):
if feedback.isCanceled():
break
outGeom = target.geometry()
@@ -97,7 +97,7 @@ def processAlgorithm(self, parameters, context, feedback):
self.lineId = 0
self.pointId = 0

features = source.getFeatures(QgsFeatureRequest().setDestinationCrs(raster_layer.crs()))
features = source.getFeatures(QgsFeatureRequest().setDestinationCrs(raster_layer.crs(), context.transformContext()))
total = 100.0 / source.featureCount() if source.featureCount() else 0
for current, f in enumerate(features):
if feedback.isCanceled():
@@ -96,7 +96,7 @@ def processAlgorithm(self, parameters, context, feedback):
polyId = 0
pointId = 0

features = source.getFeatures(QgsFeatureRequest().setDestinationCrs(raster_layer.crs()))
features = source.getFeatures(QgsFeatureRequest().setDestinationCrs(raster_layer.crs(), context.transformContext()))
total = 100.0 / source.featureCount() if source.featureCount() else 0
for current, f in enumerate(features):
if feedback.isCanceled():
@@ -114,7 +114,7 @@ def processAlgorithm(self, parameters, context, feedback):
fields, poly_source.wkbType(), poly_source.sourceCrs())

spatialIndex = QgsSpatialIndex(point_source.getFeatures(
QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(poly_source.sourceCrs())), feedback)
QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(poly_source.sourceCrs(), context.transformContext())), feedback)

point_attribute_indices = []
if weight_field_index >= 0:
@@ -140,7 +140,7 @@ def processAlgorithm(self, parameters, context, feedback):

points = spatialIndex.intersects(geom.boundingBox())
if len(points) > 0:
request = QgsFeatureRequest().setFilterFids(points).setDestinationCrs(poly_source.sourceCrs())
request = QgsFeatureRequest().setFilterFids(points).setDestinationCrs(poly_source.sourceCrs(), context.transformContext())
request.setSubsetOfAttributes(point_attribute_indices)
for point_feature in point_source.getFeatures(request):
if feedback.isCanceled():
@@ -153,7 +153,7 @@ def processAlgorithm(self, parameters, context, feedback):
feedback.setProgress(0)

da = QgsDistanceArea()
da.setSourceCrs(source.sourceCrs())
da.setSourceCrs(source.sourceCrs(), context.transformContext())
da.setEllipsoid(context.project().ellipsoid())

current = 0
@@ -109,7 +109,7 @@ def processAlgorithm(self, parameters, context, feedback):
points = dict()

da = QgsDistanceArea()
da.setSourceCrs(source.sourceCrs())
da.setSourceCrs(source.sourceCrs(), context.transformContext())
da.setEllipsoid(context.project().ellipsoid())

request = QgsFeatureRequest()
@@ -127,7 +127,7 @@ def processAlgorithm(self, parameters, context, feedback):
fields, QgsWkbTypes.Point, source.sourceCrs())

da = QgsDistanceArea()
da.setSourceCrs(source.sourceCrs())
da.setSourceCrs(source.sourceCrs(), context.transformContext())
da.setEllipsoid(context.project().ellipsoid())

total = 100.0 / source.featureCount() if source.featureCount() else 0
@@ -213,7 +213,7 @@ def processAlgorithm(self, parameters, context, feedback):

feedback.pushInfo(self.tr('Loading start points...'))
request = QgsFeatureRequest()
request.setDestinationCrs(network.sourceCrs())
request.setDestinationCrs(network.sourceCrs(), context.transformContext())
features = startPoints.getFeatures(request)
total = 100.0 / startPoints.featureCount() if startPoints.featureCount() else 0

@@ -215,7 +215,7 @@ def processAlgorithm(self, parameters, context, feedback):

feedback.pushInfo(self.tr('Loading start points...'))
request = QgsFeatureRequest()
request.setDestinationCrs(network.sourceCrs())
request.setDestinationCrs(network.sourceCrs(), context.transformContext())
features = startPoints.getFeatures(request)
total = 100.0 / startPoints.featureCount() if startPoints.featureCount() else 0

@@ -216,7 +216,7 @@ def processAlgorithm(self, parameters, context, feedback):

feedback.pushInfo(self.tr('Loading end points...'))
request = QgsFeatureRequest()
request.setDestinationCrs(network.sourceCrs())
request.setDestinationCrs(network.sourceCrs(), context.transformContext())
features = endPoints.getFeatures(request)
total = 100.0 / endPoints.featureCount() if endPoints.featureCount() else 0

0 comments on commit 3c7f745

Please sign in to comment.
You can’t perform that action at this time.