# NOT RUN {
### DIFFERENCES IN AGGREGATION
## Loading objects
data(elevraster)
data(Europefit)
data(countries)
data(oceanmask)
## We aggregate and crop using different settings
elevation.raster1 <- relevate(
elevation.raster=elevraster,
isofit=Europefit,
aggregation.factor=0)
elevation.raster2 <- relevate(
elevation.raster=elevraster,
isofit=Europefit,
aggregation.factor=5)
elevation.raster3 <- relevate(
elevation.raster=elevraster,
isofit=Europefit,
aggregation.factor=5, aggregation.fun=max)
## The following plot takes a few second too many and will
## therefore not be run unless you type:
## example(relevate, run.dontrun=TRUE)
# }
# NOT RUN {
## We plot the outcome of the 3 different aggregation schemes
if(require(rasterVis)) {
data(countries)
data(oceanmask)
plot.aggregation1 <- levelplot(elevation.raster1,
margin=FALSE, main="Original small raster") +
layer(sp.polygons(countries)) +
layer(sp.polygons(oceanmask, fill="blue"))
plot.aggregation2 <- levelplot(elevation.raster2,
margin=FALSE, main="Small raster aggregated (by mean)") +
layer(sp.polygons(countries)) +
layer(sp.polygons(oceanmask, fill="blue"))
plot.aggregation3 <- levelplot(elevation.raster3,
margin=FALSE, main="Small raster aggregated (by max)") +
layer(sp.polygons(countries)) +
layer(sp.polygons(oceanmask, fill="blue"))
## panel using lattice syntax:
print(plot.aggregation1, split=c(1, 1, 1, 3), more=TRUE)
print(plot.aggregation2, split=c(1, 2, 1, 3), more=TRUE)
print(plot.aggregation3, split=c(1, 3, 1, 3))
}
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab