Polygons as rings¶
Treat polygons as linearrings.
- class PolygonsAsRings(polys, crs=None, allow_multipart=False, gridsize=None)[source]¶
Bases:
object
Convert polygons to linearrings, apply linestring functions, then convert back to polygons.
- Parameters:
polys (GeoDataFrame | GeoSeries | GeometryArray)
crs (CRS | Any | None)
allow_multipart (bool)
gridsize (int | None)
- apply_gdf_func(func, args=None, kwargs=None)[source]¶
Apply a function that operates on a GeoDataFrame to the rings.
- Parameters:
func (
Callable
) – Function to apply that expects a GeoDataFrame.args (
tuple
|None
) – Tuple of positional arguments for the function.kwargs (
dict
|None
) – Dictionary of keyword arguments for the function.
- Returns:
The instance itself after applying the function.
- Return type:
- apply_geoseries_func(func, args=None, kwargs=None)[source]¶
Apply a function that operates on a GeoSeries to the rings.
- Parameters:
func (
Callable
) – Function to apply that expects a GeoSeries.args (
tuple
|None
) – Tuple of positional arguments for the function.kwargs (
dict
|None
) – Dictionary of keyword arguments for the function.
- Returns:
The instance itself after applying the function.
- Return type:
- apply_numpy_func(func, args=None, kwargs=None)[source]¶
Apply a numpy function to all rings of the polygons.
- Parameters:
func (
Callable
) – Numpy function to apply.args (
tuple
|None
) – Tuple of positional arguments for the function.kwargs (
dict
|None
) – Dictionary of keyword arguments for the function.
- Returns:
The instance itself after applying the function.
- Return type:
- apply_numpy_func_to_interiors(func, args=None, kwargs=None)[source]¶
Apply a numpy function specifically to the interior rings of the polygons.
- Parameters:
func (
Callable
) – Numpy function to apply.args (
tuple
|None
) – Tuple of positional arguments for the function.kwargs (
dict
|None
) – Dictionary of keyword arguments for the function.
- Returns:
The instance itself after applying the function.
- Return type:
- get_rings(agg=False)[source]¶
Retrieve rings from the polygons, optionally aggregating them.
- Parameters:
agg (
bool
) – If True, aggregate the rings into single geometries.- Return type:
GeoDataFrame
|GeoSeries
|ndarray
- Returns:
- The rings either aggregated or separated, in the type of
the input polygons.
- property is_exterior: bool¶
Returns a boolean Series of whether the row is an exterior ring.
- property is_interior: bool¶
Returns a boolean Series of whether the row is an interior ring.