Make a RasterLayer with interpolated values based on a a fitted model object of classes such as 'gstat' or 'Krige'. I.e. these are models that have 'x' and 'y' as independent variables. If x and y are the only independent variables provide an empty (no associated data in memory or on file) RasterLayer for which you want predictions. If there are more spatial predictor variables provide these as a Raster* object in the first argument of the function. If you do not have x and y locations as implicit predictors in your model you should use predict instead.

methods, spatial
interpolate(object, ...)
a Raster* object
Additional arguments. See below, under Methods

  • a RasterLayer object


predict(object, model, filename='', index=1, ...) rll{ object a RasterLayer object model A fitted model filename Output filename for a new raster; if NA the result is not written to a file but returned with the RasterLayer object, in the data slot index Which gstat variable do you want (see predict.gstat). In the case of kriging, 1=prediction and 2=prediction variance. ... Additional arguments, see below } The following additional arguments can be passed, to replace default values rll{ format Character. Output file type. See writeRaster datatype Character. Output data type. See dataType overwrite Logical. If TRUE, "filename" will be overwritten if it exists progress Character. Valid values are "text", "tcltk", "windows" (on that platform only) and "" }

See Also

predict, predict.gstat, Tps

  • interpolate
  • interpolate,Raster-method
## Thin plate spline interpolation with x and y only
r <- raster(system.file("external/test.grd", package="raster"))
ra <- aggregate(r, 10)
xy <- data.frame(xyFromCell(ra, 1:ncell(ra)))
v <- getValues(ra)
tps <- Tps(xy, v)
p <- raster(r)
p <- interpolate(p, tps)
p <- mask(p, r)

##gstat examples

## inverse distance weighted interpolation with gstat
#r <- raster(system.file("external/test.grd", package="raster"))
#mg <- gstat(id = "zinc", formula = zinc~1, locations = ~x+y, data=meuse, nmax=7, set=list(idp = .5))
#z <- interpolate(r, mg)
#z <- mask(z, r)

## kriging
#coordinates(meuse) = ~x+y
#v <- variogram(log(zinc)~1, meuse)
#m <- fit.variogram(v, vgm(1, "Sph", 300, 1))
#g <- gstat(NULL, "log.zinc", log(zinc)~1, meuse, model = m)
#projection(r) <- projection(meuse)
#x <- interpolate(r, g)
Documentation reproduced from package raster, version 1.0.0-1, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.