Description Usage Arguments Value Examples
This function calculate statistics for each zone defined by a zone dataset.
1 2 |
x |
the raster dataset to be calculated |
zonal.ras |
a raster objects indicating each zone |
stat |
character.statistics method to be performed.The defautl value is 'mean'. |
na.rm |
logic indicating whether to remove NA value during the zonal statistic.The default value is true |
prefix |
character indicating column name prefix of zonal statistical value. |
digit |
integer indicating the number of decimal places (round) for zone id.The default value is 0. |
RasterLayer
1 2 3 4 5 6 7 8 9 10 11 | gg<-loadGRID()
res.test<-1e4
zonal.ras<-rasterize.gdal(china.pop[,'county_ID'],'county_ID',res=res.test)
grid.poly.proj<-gg%>%spTransform(proj4string(china.pop))
o3.test1<-rasterize.gdal(grid.poly.proj,names(grid.poly.proj)[2],res=res.test,
extent=extent(china.pop))
zonal.test<-zonalStat(zonal.ras,val.ras =o3.test1)
############## batch processing ######
o3.stack.3<-lapply(names(grid.poly.proj)[-1],rasterize.gdal,
x=grid.poly.proj,res=res.test,extent=extent(china.pop))
zonal.res.all<-lapply(X=o3.stack.3,FUN = zonalStat,zonal.ras=zonal.ras)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.