Learn R Programming

intamap (version 1.5-7)

createIntamapObject: Create an object for interpolation within the intamap package

Description

This is a help function for creating an object (see intamap-package to be used for interpolation within the intamap-package

Usage

createIntamapObject(observations, obsChar, formulaString,
            predictionLocations=100, targetCRS, boundaries, boundaryLines,
            intCRS, params=list(), boundFile, lineFile, class="idw",
            outputWhat, blockWhat = "none",...)

Value

An object with observations, prediction locations, parameters and possible additional elements for automatic interpolation. The object will have class equal to the value of argument class, and methods in the intamap-package will dispatch on the object according to this class.

Arguments

observations

a SpatialPointsDataFrame, SpatialPixelsDataFrame, SpatialGridDataFrame, SpatialLinesDataFrame or SpatialPolygonsDataFrame with observations. Note that there are only few methods that can actually handle interpolation of observations with a support

obsChar

list with observation characteristics, used by some interpolation methods

formulaString

formula that defines the dependent variable as a linear model of independent variables; suppose the dependent variable has name z, for ordinary and simple kriging use the formula z~1; for universal kriging, suppose z is linearly dependent on x and y, use the formula z~x+y. The formulaString defaults to "value~1" if value is a part of the data set. If not, the first column of the data set is used.

predictionLocations

either a Spatial* object with prediction locations or an integer with the requested number of prediction locations. If boundaries are supported, the sampled prediction locations will be sampled within the boundaries

targetCRS

the wanted projection for the interpolated map

boundaries

SpatialPolygonsDataFrame with the boundaries of regions in the prediction region

boundaryLines

SpatialPointsDataFrame with the boundaries between pairs of regions discretized as points. Will be read from file if lineFile is given or will be created from boundaries if not.

intCRS

a particular projection requested for the interpolation

params

parameters for the interpolation, given as exceptions to the default parameters set in the function getIntamapParams. It is also possible to pass a methodParameters from an earlier call, as defined from the function methodParameters.

boundFile

Filename where boundaries can be found, e.g. a shapefile

lineFile

Filename where paired points on boundaries can be found

class

setting the class(es) of the object, see intamap-package

outputWhat

List defining the requested type of output. Parameters:

mean = TRUE

Usual kriging prediction

variance = TRUE

Usual kriging error

quantile

The estimated quantile for a certain threshold

excprob

Exceedance probability for a certain threshold

cumdistr

The cumulative distribution for a certain value

MOK

Assumed unbiased prediction using the MOK method for the threshold given. See unbiasedKrige

IWQSEL

Assumed unbiased prediction using the IWQSEL method for the threshold given. See unbiasedKrige

...

Additional prediction types that do not exist in the default parameter set, particularly parameters necessary for new methods within the intamap-package.

The list defaults to list (mean = TRUE) for objects of class IDW and list(mean=TRUE, variance = TRUE) for all other objects.

blockWhat

List defining particular output for block predictions. These include:

blockMax

logical; whether to predict maximum within block, if block predictions

blockMin

logical; whether to predict mimimum within block, if block predictions

fat

Prediction of area within block above a threshold (fat = threshold

blockMaxVar

logical; whether to predict the variance of the prediction of max within the block, similarly it is possible to set blockMinVar = TRUE and fatVar = threshold

...
  • Either: other elements that can be used by particular interpolation methods. These are added to the object as named elements.

  • Or: elements that have been created in earlier calls to one of the functions in the intamap-package, and that are not supposed to change in the second call. By adding these elements to the object in createIntamapObject, they can be reused without having to re-estimate them. Typical examples are the elements created from a call to preProcess

Author

Jon Olav Skoien

Details

This function is a help function for creating an object (see intamap-package) for interpolation within the intamap-package. The function uses some default values if certain elements are not included.

If createIntamapObject is called without predictionLocations, or if a number is given, the function will sample a set of predictionLocations. These will be sampled from a regular grid.

targetCRS and intCRS are not mandatory variables, but are recommended if the user wants predictions of a certain projection. intCRS is not necessary if the targetCRS is given and has a projection (is not lat-long). It is recommended to include the argument intCRS if all projected elements are lat-long, as many of the interpolation methods do not work optimal with lat-long data.

The ...-argument can be used for arguments necessary for new methods not being a part of the intamap-package. It is also a method for reusing previously calculated elements that can be assumed to be unchanged for the second interpolation.

References

Pebesma, E., Cornford, D., Dubois, G., Heuvelink, G.B.M., Hristopulos, D., Pilz, J., Stohlker, U., Morin, G., Skoien, J.O. INTAMAP: The design and implementation f an interoperable automated interpolation Web Service. Computers and Geosciences 37 (3), 2011.

See Also

intamap-package and getIntamapParams

Examples

Run this code
# set up data:
data(meuse)
coordinates(meuse) = ~x+y
meuse$value = log(meuse$zinc)
data(meuse.grid)
gridded(meuse.grid) = ~x+y
proj4string(meuse) = CRS("+init=epsg:28992")
proj4string(meuse.grid) = CRS("+init=epsg:28992")

# set up intamap object:
idwObject = createIntamapObject(
	observations = meuse,
	predictionLocations = meuse.grid,
	targetCRS = "+init=epsg:3035",
	class = "idw"
)

Run the code above in your browser using DataLab