GlacioHack / geoutils

Analysis of georeferenced rasters and vectors
https://geoutils.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
82 stars 19 forks source link

Raster clipping #583

Open adehecq opened 3 months ago

adehecq commented 3 months ago

It would be great to have a function to clip a raster to a vector. Currently, the function Raster.crop if passed a vector can crop to the bounds of the vector, but it will not clip (set values to nodata outside the vector outlines). Vector.crop has an option "clip" to do that. Maybe we could just add a similar "clip" option to Raster.crop that works when the input is a vector?

rhugonnet commented 3 months ago

Good idea, would basically be the equivalent of crop + create_mask + set_mask?

adehecq commented 3 months ago

Good idea, would basically be the equivalent of crop + create_mask + set_mask?

I think so !