replace_closest_polygon

replace_closest_polygon#

zeroheliumkit.src.utils.replace_closest_polygon(multipolygon: MultiPolygon, point: Point, new_polygon: Polygon) MultiPolygon[source]#

Replaces the closest polygon in a MultiPolygon with a new polygon.

Parameters:
  • multipolygon (MultiPolygon) – The input Shapely MultiPolygon.

  • point (Point) – The Shapely point to compare.

  • new_polygon (Polygon) – The new polygon to replace the closest one.

Returns:

A new MultiPolygon with the closest polygon replaced.

Return type:

MultiPolygon