Skip to content

In connection with the creation of a grid of point with gstat

2 messages · alain ponsero, Roger Bivand

#
On Fri, 10 Jun 2005, alain ponsero wrote:

            
In the meuse example, the meuse.grid locations are provided. They are 
essentially the same as the code snippet in the example for 
predict.gstat():

     # unconditional simulation on a 100 x 100 grid
     xy <- expand.grid(1:100, 1:100)
     names(xy) <- c("x","y")
     g.dummy <- gstat(formula = z~1, locations = ~x+y, dummy = TRUE, beta = 0,
             model = vgm(1,"Exp",15), nmax = 20)
     yy <- predict(g.dummy, newdata = xy, nsim = 4)

that is using expand.grid() and giving the output object the correct names 
for your coordinates. If you need to mask the grid, you need to choose 
just some rows of xy for prediction (perhaps using the overlay() method in 
the sp package).