window_from_bounds
python
def window_from_bounds(
geotiff: GeoTIFF,
bounds: tuple[float, float, float, float],
*,
crs: str | int | CRS | Proj,
require_fully_contained: bool = False,
) -> WindowConvert geographic bounds to an outward-rounded GeoTIFF pixel window clipped to the image.
Parameters
geotiff GeoTIFF The open async-geotiff image.
bounds tuple[float, float, float, float] Coordinates in (left, bottom, right, top) order.
crs str | int | CRS | Proj The coordinate reference system of bounds.
require_fully_contained bool Whether to reject bounds that extend beyond the image instead of clipping
them. Defaults to False.
Returns
An async-geotiff Window containing every pixel touched by the bounds.