diff --git a/doc/source/raster_class.md b/doc/source/raster_class.md index ae8b6475..80d3904c 100644 --- a/doc/source/raster_class.md +++ b/doc/source/raster_class.md @@ -262,6 +262,19 @@ rast_crop = rast.crop(crop_geom=(0.3, 0.3, 1, 1)) print(rast_crop.bounds) ``` +A crop can also be done during its initialization by passing a Region of Interest (ROI) to the Raster class via the `roi` parameter. +The `roi` can be specified in two formats: +- **Pixel-based ROI:** Defined by the pixel coordinates with the following keys: `left`, `bottom`, `right`, and `top`. +- **Georeferenced ROI:** Defined by geographical coordinates with the following keys: `lat_min`, `lat_max`, `lon_min`, `lon_max` and optional `crs` (Coordinate Reference System, defaults to EPSG:4326 if not provided). + +```{code-cell} ipython3 +# Initialize a raster with a pixel-based ROI +rast_roi = gu.Raster(filename_rast, load_data=True, roi={'left': 100, 'bottom': 200, 'right': 400, 'top': 500}) + +# Initialize a raster with a georeferenced ROI +rast_roi = gu.Raster(filename_rast, load_data=True, roi={'lat_min': 630175, 'lat_max': 639175, 'lon_min': 4839545, 'lon_max': 4848545, 'crs': 'EPSG:32718'}) +``` + ## Polygonize Polygonizing a {class}`~geoutils.Raster` is done through the {func}`~geoutils.Raster.polygonize` function, which converts target pixels into a multi-polygon