fill_polygon_holes

fill_polygon_holes#

fill_polygon_holes(gpd_results: GeoDataFrame, threshold: float | None = None) GeoDataFrame[source]#

Fill holes over a given threshold on the hole area (in meters) for all polygons of a GeoDataFrame. If the threshold is set to None, every hole is filled.

Parameters:
  • gpd_results (gpd.GeoDataFrame) – Geodataframe filled whith drilled polygons

  • threshold (float) – Holes area threshold, in meters. If set to None, every hole is filled.

Returns:

GeoDataFrame with filled holes

Return type:

gpd.GeoDataFrame

Example

>>> # Open a polygon with holes
>>> holes = vectors.read("holes.geojson")
>>> # This polygons has interiors features, it has holes
>>> holes.interiors
3    [LINEARRING (491328.9981955575 5616655.8234532...
dtype: object
>>> no_holes = fill_polygon_holes(holes)
Processing objects: 100%|██████████| 1/1 [00:00<00:00, 897.18it/s]
>>> no_holes.interiors
0    []
dtype: object