diff --git a/python/plugins/processing/algs/qgis/Delaunay.py b/python/plugins/processing/algs/qgis/Delaunay.py index 9bd001fc763..1bc2875b7e0 100644 --- a/python/plugins/processing/algs/qgis/Delaunay.py +++ b/python/plugins/processing/algs/qgis/Delaunay.py @@ -148,7 +148,7 @@ class Delaunay(QgisAlgorithm): attrs.append(ids[index]) step += 1 feat.setAttributes(attrs) - geometry = QgsGeometry().fromPolygon([polygon]) + geometry = QgsGeometry().fromPolygonXY([polygon]) feat.setGeometry(geometry) sink.addFeature(feat, QgsFeatureSink.FastInsert) feedback.setProgress(int(current * total)) diff --git a/python/plugins/processing/algs/qgis/GridPolygon.py b/python/plugins/processing/algs/qgis/GridPolygon.py index 262e807f29c..cd0a1c3575c 100644 --- a/python/plugins/processing/algs/qgis/GridPolygon.py +++ b/python/plugins/processing/algs/qgis/GridPolygon.py @@ -190,7 +190,7 @@ class GridPolygon(QgisAlgorithm): polyline.append(QgsPointXY(x1, y2)) polyline.append(QgsPointXY(x1, y1)) - ft.setGeometry(QgsGeometry.fromPolygon([polyline])) + ft.setGeometry(QgsGeometry.fromPolygonXY([polyline])) ft.setAttributes([x1, y1, x2, y2, id]) sink.addFeature(ft, QgsFeatureSink.FastInsert) @@ -245,7 +245,7 @@ class GridPolygon(QgisAlgorithm): polyline.append(QgsPointXY(x2, y3)) polyline.append(QgsPointXY(x1, y2)) - ft.setGeometry(QgsGeometry.fromPolygon([polyline])) + ft.setGeometry(QgsGeometry.fromPolygonXY([polyline])) ft.setAttributes([x1, y1, x3, y3, id]) sink.addFeature(ft, QgsFeatureSink.FastInsert) id += 1 @@ -312,7 +312,7 @@ class GridPolygon(QgisAlgorithm): polyline.append(QgsPointXY(x2, y3)) polyline.append(QgsPointXY(x1, y2)) - ft.setGeometry(QgsGeometry.fromPolygon([polyline])) + ft.setGeometry(QgsGeometry.fromPolygonXY([polyline])) ft.setAttributes([x1, y1, x4, y3, id]) sink.addFeature(ft, QgsFeatureSink.FastInsert) id += 1 diff --git a/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py b/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py index f680c8a7328..44ec1e7fd88 100644 --- a/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py +++ b/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py @@ -134,7 +134,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm): polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) @@ -153,7 +153,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm): points = [(-xOffset, -yOffset), (-xOffset, yOffset), (xOffset, yOffset), (xOffset, -yOffset)] polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) @@ -183,7 +183,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm): polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) feedback.setProgress(int(current * total)) @@ -201,7 +201,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm): points = [(0.0, -yOffset), (-xOffset, 0.0), (0.0, yOffset), (xOffset, 0.0)] polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) feedback.setProgress(int(current * total)) @@ -232,7 +232,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm): polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) feedback.setProgress(int(current * total)) @@ -252,7 +252,7 @@ class RectanglesOvalsDiamondsFixed(QgisAlgorithm): points.append((xOffset * math.cos(t), yOffset * math.sin(t))) polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) feedback.setProgress(int(current * total)) diff --git a/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py b/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py index e59292ec65c..11c55d4f3c1 100644 --- a/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py +++ b/python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py @@ -156,7 +156,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm): polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) @@ -186,7 +186,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm): points = [(-xOffset, -yOffset), (-xOffset, yOffset), (xOffset, yOffset), (xOffset, -yOffset)] polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) @@ -225,7 +225,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm): polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) feedback.setProgress(int(current * total)) @@ -254,7 +254,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm): points = [(0.0, -yOffset), (-xOffset, 0.0), (0.0, yOffset), (xOffset, 0.0)] polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) feedback.setProgress(int(current * total)) @@ -294,7 +294,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm): polygon = [[QgsPointXY(i[0] * math.cos(phi) + i[1] * math.sin(phi) + x, -i[0] * math.sin(phi) + i[1] * math.cos(phi) + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) feedback.setProgress(int(current * total)) @@ -325,7 +325,7 @@ class RectanglesOvalsDiamondsVariable(QgisAlgorithm): points.append((xOffset * math.cos(t), yOffset * math.sin(t))) polygon = [[QgsPointXY(i[0] + x, i[1] + y) for i in points]] - ft.setGeometry(QgsGeometry.fromPolygon(polygon)) + ft.setGeometry(QgsGeometry.fromPolygonXY(polygon)) ft.setAttributes(feat.attributes()) sink.addFeature(ft, QgsFeatureSink.FastInsert) feedback.setProgress(int(current * total)) diff --git a/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py b/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py index d49130eed6e..f07681fc18c 100644 --- a/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py +++ b/python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py @@ -253,8 +253,8 @@ class ServiceAreaFromLayer(QgisAlgorithm): upperBoundary.append(graph.vertex(graph.edge(tree[j]).inVertex()).point()) lowerBoundary.append(graph.vertex(graph.edge(tree[j]).outVertex()).point()) - geomUpper = QgsGeometry.fromMultiPoint(upperBoundary) - geomLower = QgsGeometry.fromMultiPoint(lowerBoundary) + geomUpper = QgsGeometry.fromMultiPointXY(upperBoundary) + geomLower = QgsGeometry.fromMultiPointXY(lowerBoundary) feat.setGeometry(geomUpper) feat['type'] = 'upper' diff --git a/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py b/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py index 8188731a719..90174959483 100644 --- a/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py +++ b/python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py @@ -227,8 +227,8 @@ class ServiceAreaFromPoint(QgisAlgorithm): feat = QgsFeature() feat.setFields(fields) - geomUpper = QgsGeometry.fromMultiPoint(upperBoundary) - geomLower = QgsGeometry.fromMultiPoint(lowerBoundary) + geomUpper = QgsGeometry.fromMultiPointXY(upperBoundary) + geomLower = QgsGeometry.fromMultiPointXY(lowerBoundary) (sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context, fields, QgsWkbTypes.MultiPoint, network.sourceCrs()) @@ -245,7 +245,7 @@ class ServiceAreaFromPoint(QgisAlgorithm): upperBoundary.append(startPoint) lowerBoundary.append(startPoint) - geomUpper = QgsGeometry.fromMultiPoint(upperBoundary) - geomLower = QgsGeometry.fromMultiPoint(lowerBoundary) + geomUpper = QgsGeometry.fromMultiPointXY(upperBoundary) + geomLower = QgsGeometry.fromMultiPointXY(lowerBoundary) return {self.OUTPUT: dest_id} diff --git a/python/plugins/processing/algs/qgis/VoronoiPolygons.py b/python/plugins/processing/algs/qgis/VoronoiPolygons.py index c3c08a167f3..f3d3833c769 100644 --- a/python/plugins/processing/algs/qgis/VoronoiPolygons.py +++ b/python/plugins/processing/algs/qgis/VoronoiPolygons.py @@ -135,7 +135,7 @@ class VoronoiPolygons(QgisAlgorithm): inFeat = next(source.getFeatures(request)) lines = self.clip_voronoi(edges, c, width, height, extent, extraX, extraY) - geom = QgsGeometry.fromMultiPoint(lines) + geom = QgsGeometry.fromMultiPointXY(lines) geom = QgsGeometry(geom.convexHull()) outFeat.setGeometry(geom) outFeat.setAttributes(inFeat.attributes()) diff --git a/python/plugins/processing/algs/qgis/scripts/Keep_n_biggest_parts.py b/python/plugins/processing/algs/qgis/scripts/Keep_n_biggest_parts.py index f2111c3a889..3de769dfa47 100644 --- a/python/plugins/processing/algs/qgis/scripts/Keep_n_biggest_parts.py +++ b/python/plugins/processing/algs/qgis/scripts/Keep_n_biggest_parts.py @@ -39,7 +39,7 @@ for n, feat in enumerate(Polygons.getFeatures()): else: features.setGeometry(geom) geomres = [geoms[i].asPolygon() for i, a in geomarea[-1 * To_keep:]] - features.setGeometry(QgsGeometry.fromMultiPolygon(geomres)) + features.setGeometry(QgsGeometry.fromMultiPolygonXY(geomres)) sink.addFeature(features) else: sink.addFeature(feat)