gt_zonal: Zonal statistics

Description Usage Arguments Value Examples

Description

Calculate statistics from a gt_RasterLayer object using zones specified in a second gt_RasterLayer.

Usage

1
2
3
4
gt_zonal(x, z)

## S4 method for signature 'gt_RasterLayer,gt_RasterLayer'
gt_zonal(x, z)

Arguments

x

gt_RasterLayer object.

z

gt_RasterLayer object with codes representing zones.

Value

matrix object with a value for each zone (unique values in) z. #' @details This function calculates the mean, median, mode, and standard deviation in each zone. It is similar to zonal.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
g <- gt_raster(raster::raster(matrix(runif(9), ncol=3),
                              crs=sp::CRS('+init=epsg:4326'),
                              xmn=0, xmx=3, ymn=2, ymx=10))
z <- gt_raster(raster::raster(matrix(sample(1:3, 9, replace=TRUE), ncol=3),
                              crs=sp::CRS('+init=epsg:4326'),
                              xmn=0, xmx=3, ymn=2, ymx=10))
result <- gt_zonal(g, z)

## End(Not run)

jeffreyhanson/geotrellis documentation built on May 19, 2019, 4 a.m.