Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/geogenalg/application/generalize_water_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ def _get_shoreline_gdf_segments_and_skip_coords(
data: GeoDataFrame,
) -> tuple[GeoDataFrame, GeoDataFrame, MultiPoint]:
shoreline_gdf = data.loc[data.geometry.geom_type == "LineString"].copy()
shoreline_gdf.geometry = shoreline_gdf.geometry.force_2d()

if not shoreline_gdf.empty:
# Extract out any points which are found in the input (Polygon)
# data, but not the shoreline LineString data. This allows to
# determine non-shoreline vertices (e.g. territorial water borders
# in case of sea areas) and skip smoothing them later.
segments = get_segments_in_polygon_boundary_but_not_in_lines(
data,
data.geometry.force_2d(),
shoreline_gdf,
)

Expand Down
4 changes: 2 additions & 2 deletions src/geogenalg/continuity.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from warnings import warn

import numpy as np
from geopandas import GeoDataFrame
from geopandas import GeoDataFrame, GeoSeries
from networkx.classes.graph import Graph
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
Expand Down Expand Up @@ -994,7 +994,7 @@ def add_contiguous_lines_information( # noqa: PLR0913


def get_segments_in_polygon_boundary_but_not_in_lines(
polygons: GeoDataFrame,
polygons: GeoDataFrame | GeoSeries,
lines: GeoDataFrame,
) -> GeoDataFrame:
"""Find line segments present in polygons but not lines.
Expand Down
Binary file modified tests/testdata/algo/water_areas.gpkg
Binary file not shown.
Binary file modified tests/testdata/algo/watercourse_areas.gpkg
Binary file not shown.
Loading