File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,19 @@ def union_geometries(geometries: List[QgsGeometry]) -> QgsGeometry:
5151 """
5252 Unions geometries, using the optimal method available
5353 """
54- if Qgis .QGIS_VERSION_INT >= 33600 :
54+ if Qgis .QGIS_VERSION_INT >= 34100 :
55+ # use optimized GEOS coverage union method
56+ # this is only possible for polygons, which should be safe to
57+ # assume, unless we are running the test suite!
58+ if all (g .type () == QgsWkbTypes .PolygonGeometry for g in
59+ geometries ):
60+ collected_multi_polygon = QgsGeometry .collectGeometry (geometries )
61+ # use low-level API so that we can specify a 0.005m tolerance, to avoid
62+ # slivers
63+ geos_engine = QgsGeometry .createGeometryEngine (collected_multi_polygon .constGet (), 0.005 )
64+ geom , err = geos_engine .unionCoverage ()
65+ return QgsGeometry (geom )
66+ elif Qgis .QGIS_VERSION_INT >= 33600 :
5567 # use optimized GEOS coverage union method
5668 # this is only possible for polygons, which should be safe to
5769 # assume, unless we are running the test suite!
You can’t perform that action at this time.
0 commit comments