View source: R/raster_intersect_sp.R
raster_intersect_sp | R Documentation |
Straightforward application of crop
and
mask
to extract the data in the intersection of
Raster*
and SpatialPolygonsDataframe
objects.
raster_intersect_sp( x, y, features, save = FALSE, dirToSave, baseName = "x_intersect_y", format = "GTiff" )
x |
|
y |
|
features |
integer vector. Should some specifying features (polygons) of |
save |
logical. Should the output be saved? Default, |
dirToSave |
character specifying where to save output. Required when |
baseName |
character. What should be the base name of output file? Default,
|
format |
character specifying output file format. See |
When save=TRUE
, writeRaster
is used with
argument datatype=dataType(subset(x,1))
.
An object of class identical to that of argument x
raster_path = system.file("extdata", "MOD13Q1_NDVI_Mohinora.tif", package = "geoTS") rasterSTACK <- stack(raster_path) dir.create(path=paste0(system.file("extdata", package="geoTS"), "/output_raster_inter_sp"), showWarnings=FALSE) dirToSave = paste0(system.file("extdata", package="geoTS"), "/output_raster_inter_sp") raster_intersect_sp(x=rasterSTACK, y=shp_mohinora, save=TRUE, dirToSave=dirToSave, baseName="mohinora_NDVI_2001")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.