Commit dbf0e281 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Improved warning message.


Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 93266891
Pipeline #15124 passed with stage
in 26 seconds
......@@ -194,14 +194,15 @@ def fill_holes_within_poly(poly):
# noinspection PyTypeChecker
gdf['within_or_equal'] = gdf.apply(
lambda GDF_row:
GDF_row.geometry.within(largest_poly_filled) or
GDF_row.geometry.within(largest_poly_filled.buffer(1e-5)) or
GDF_row.geometry.equals(largest_poly_filled),
axis=1)
if False in gdf.within_or_equal:
warnings.warn(RuntimeWarning('The given MultiPolygon contains disjunct polygones outside of the largest '
'polygone. fill_holes_within_poly() will only return the largest polygone as '
'a filled version.'))
n_disjunct_polys = int(np.sum(~gdf.within_or_equal))
warnings.warn(RuntimeWarning('The given MultiPolygon contains %d disjunct polygone(s) outside of the '
'largest polygone. fill_holes_within_poly() will only return the largest '
'polygone as a filled version.' % n_disjunct_polys))
# return the outer boundary of the largest polygon
filled_poly = Polygon(np.swapaxes(np.array(largest_poly_filled.exterior.coords.xy), 0, 1))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment