I would like to crop a raster based on SpatialPolygons
object. I know that we can use crop
function in raster
package,
raster::crop(rasterFile, SpatialPolygonsObject)
but this function is based on the extent
of SpatialPolygons
object, so the cropped result is rectangle. However, in some case, SpatialPolygons
object is not rectangle, how to deal these situations?