[R-sig-Geo] Defining a grid for interpolations ?

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue May 27 15:34:45 CEST 2008


Mauricio Zambrano wrote:
> Dear Paul and Edzer,
>
> Thanks a lot for your answers.
>
> Before reading the solution proposed by Paul, I had tried with:
>
> # reading the boundary of the catchment
> library(maptools)
> catchment <- readShapePoly("only_catchment.shp")
> catchment.grid <- spsample(catchment, cellsize=100, offset = c(0.5,
> 0.5)) # reading the boundary of the catchment
>
>  and then I did an IDW interpolation with:
>
> pp.idw <- krige(PP_DAILY_MEAN_MM~1, meteo, catchment.grid)
>
> and it works.
>
> However, after reading your solution, I realised that I didn't use the command:
>
> gridded(catchment.grid)
>
> but I got an interpolation anyway.
>
> Where is performed the interpolation when I don't use a gridded grid (
> gridded(catchment.grid) ) ?
>   
it is actually

gridded(catchment.grid) <- TRUE

that changes the object, if it not gridded.

For interpolation, it doesn't matter whether you loop over a set of 
points, or a set of points on a grid.
--
Edzer




More information about the R-sig-Geo mailing list