crop_theusin | R Documentation |
Function that crops a raster/rasterstack using a shapefile.
crop_theusin(dataset, shape)
dataset |
Raster* object or SpatialPolygons*, SpatialLines*, or SpatialPoints* object |
shape |
a Extent object, or any object from which an Extent object can be extracted. (shapefile) |
RasterLayer or RasterBrick object; or SpatialLines or SpatialPolygons object.
Remember to Check if dataset and shape have the same crs.
r <- raster::raster(nrow=45, ncol=90)
num_cells <- raster::ncell(r)
raster::values(r) <- 1:num_cells
e <- raster::extent(-160, 10, 30, 60)
crop_theusin(r, e)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.