From 780e2f185ccb443a310af4197c987a34c12db51b Mon Sep 17 00:00:00 2001 From: Wolfgang Kaltz Date: Wed, 4 Jan 2023 16:22:01 +0100 Subject: [PATCH] Fix shapely deprecation warnings (in preparation for upgrade to Shapely 2) (#1647) --- pyramid_oereb/core/records/geometry.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyramid_oereb/core/records/geometry.py b/pyramid_oereb/core/records/geometry.py index 24d87ec4f2..1f4f970fd0 100644 --- a/pyramid_oereb/core/records/geometry.py +++ b/pyramid_oereb/core/records/geometry.py @@ -2,11 +2,10 @@ import logging from datetime import datetime -from shapely.ops import linemerge, cascaded_union +from shapely.ops import linemerge, unary_union from shapely.geometry import Point, MultiPoint, LineString, Polygon, GeometryCollection, MultiLineString, \ MultiPolygon -from shapely.ops import unary_union log = logging.getLogger(__name__) @@ -113,7 +112,7 @@ def _extract_collection(self, result): """ if isinstance(result, GeometryCollection): matching_geometries = list() - for part in result: + for part in result.geoms: if self.geom_dim(part) == self.dim: matching_geometries.append(part) if self.dim == 0: @@ -127,7 +126,7 @@ def _extract_collection(self, result): elif self.dim == 1: return linemerge(matching_geometries) elif self.dim == 2: - return cascaded_union(matching_geometries) + return unary_union(matching_geometries) else: return result