Function used to extract values of a single- or multi- band raster for pixels corresponding to the features of a vector (Polygon, Point or Line)

aggregate_rast(in_val_rast, in_zones_rast, FUN = mean,
  maxchunk = 5e+07, method = "disk", out_type = "rastobject",
  out_file = NULL, nodata_in = NULL, verbose = TRUE,
  overwrite = FALSE)

Arguments

in_val_rast

Object of class Raster* or filename corresponding to a valid raster file

in_zones_rast

PARAM_DESCRIPTION

FUN

PARAM_DESCRIPTION, Default: mean

maxchunk

PARAM_DESCRIPTION, Default: 5e+07

method

PARAM_DESCRIPTION, Default: "disk"

out_type

PARAM_DESCRIPTION, Default: 'rastobject'

out_file

PARAM_DESCRIPTION, Default: NULL

nodata_in

PARAM_DESCRIPTION, Default: NULL

verbose

PARAM_DESCRIPTION, Default: TRUE

overwrite

logical If TRUE, existing files are overwritten, Default: FALSE

Value

OUTPUT_DESCRIPTION

Details

DETAILS

Examples

in_file <- system.file("extdata/MODIS_test", "EVIts_test.tif", package = "sprawl.data") in_rast <- read_rast(in_file, bands = 20) tempraster <- tempfile(fileext = ".tif") in_obj_zones <- raster::aggregate(in_rast, fact = 4, filename = tempraster, overwrite = TRUE) test <- aggregate_rast(in_rast, in_obj_zones, FUN = mean)
#> aggregate_raster --> Aggregating values of `in_rast` on cells of `in_obj_zones`
#> --> Creating Fishnet on zones_rast
#> --> Extracting values of in_val_rast on cells of in_zones_rast
#> Loading required package: sp
#> #> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:raster’: #> #> intersect, select, union
#> The following object is masked from ‘package:testthat’: #> #> matches
#> The following objects are masked from ‘package:stats’: #> #> filter, lag
#> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union
#> #> Attaching package: ‘data.table’
#> The following objects are masked from ‘package:dplyr’: #> #> between, first, last
#> The following object is masked from ‘package:raster’: #> #> shift
#> Linking to GEOS 3.6.2, GDAL 2.3.2, PROJ 5.2.0
#> #> Attaching package: ‘sf’
#> The following object is masked from ‘package:gdalUtils’: #> #> gdal_rasterize
#> aggregate_raster --> Assigning extracted values to a new raster