BoundingBox
- class spectral_indices.roi.BoundingBox(bbox, crs)[source]
Initialize the bounding box with coordinates and a CRS.
- Parameters:
bbox (Union[List[float], Tuple[float, ...]]) – Xmin, Ymin, Xmax, Ymax.
crs (Union[str, CRS]) – Coordinate reference system.
- classmethod from_geodataframe(shape_data: GeoDataFrame | str | Path) BoundingBox[source]
Create BoundingBox from shape file or geoDataFrame.
- Parameters:
shape_data (
Union[gpd.GeoDataFrame, Union[str, Path]]) – Path to shape file or geoDataFrame.- Raises:
ValueError – CRS is null.
- Returns:
Shape corresponding BoundingBox.
- Return type:
BoundingBox
- classmethod from_raster(raster_data: str | Path | Dataset | DataArray) BoundingBox[source]
Create an instance of BoundingBox from a raster file or rio xarray.
- Parameters:
raster_data (
Union[Union[str, Path], Union[Dataset, DataArray]]) – Path to raster file or xarray with rio attr.- Returns:
Raster corresponding BoundingBox
- Return type:
BoundingBox
- to_geodataframe() GeoDataFrame[source]
Convert the bbox to a GeoDataFrame with CRS.
- Returns:
GeoDataFrame containing the bbox.
- Return type:
gpd.GeoDataFrame
- transform(target_crs: str | CRS) BoundingBox[source]
Reproject the bbox to another CRS and return a new BoundingBox.
- Parameters:
target_crs (Union[str, CRS]) – The target coordinate reference system.
- Returns:
A new BoundingBox reprojected to the target CRS.
- Return type: