crop_theusin: Function for cropping spatial files.

View source: R/crop_theusin.R

crop_theusinR Documentation

Function for cropping spatial files.

Description

Function that crops a raster/rasterstack using a shapefile.

Usage

crop_theusin(dataset, shape)

Arguments

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)

Value

RasterLayer or RasterBrick object; or SpatialLines or SpatialPolygons object.

Note

Remember to Check if dataset and shape have the same crs.

Examples


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)

Matheusbp/GemirTools documentation built on Jan. 31, 2025, 5:48 p.m.