diff --git a/geoutils/vector/geometric.py b/geoutils/vector/geometric.py index a30404a6..a6172a28 100644 --- a/geoutils/vector/geometric.py +++ b/geoutils/vector/geometric.py @@ -41,16 +41,16 @@ def _buffer_metric(gdf: gpd.GeoDataFrame, buffer_size: float) -> gu.Vector: def _buffer_without_overlap( - gdf: gpd.GeoDataFrame, buffer_size: int | float, metric: bool = True, plot: bool = False + ds: gpd.GeoDataFrame, buffer_size: int | float, metric: bool = True, plot: bool = False ) -> gu.Vector: """See Vector.buffer_without_overlap() for details.""" # Project in local UTM if metric is True if metric: - crs_utm_ups = _get_utm_ups_crs(df=gdf) - gdf = gdf.to_crs(crs=crs_utm_ups) + crs_utm_ups = _get_utm_ups_crs(df=ds) + gdf = ds.to_crs(crs=crs_utm_ups) else: - gdf = gdf + gdf = ds # Dissolve all geometries into one merged = gdf.dissolve() @@ -111,7 +111,7 @@ def _buffer_without_overlap( # Reverse-project to the original CRS if metric is True if metric: - merged_voronoi = merged_voronoi.to_crs(crs=gdf.crs) + merged_voronoi = merged_voronoi.to_crs(crs=ds.crs) return gu.Vector(merged_voronoi) diff --git a/tests/test_vector/test_geometric.py b/tests/test_vector/test_geometric.py index 20d38463..43858dcd 100644 --- a/tests/test_vector/test_geometric.py +++ b/tests/test_vector/test_geometric.py @@ -172,6 +172,7 @@ def test_buffer_without_overlap(self, monkeypatch) -> None: # type: ignore # Output should be of same size as input and same geometry type assert len(buffer.ds) == len(two_squares.ds) assert np.all(buffer.ds.geometry.geom_type == two_squares.ds.geometry.geom_type) + assert buffer.crs == two_squares.crs # Extract individual geometries polys = []