expand.grid can be a wasteful way of defining your grid, because of data.frame rownames -so you should try to avoid that by using SpatialGridDataFrame (and AttributeList) directly, rather than the (convenient) SPDF->gridded->fullgrid path.
I can't test at the moment, so sorry for that but this might help. ## you might have to work with the cell corners, rather than centres ## and I might have the x/y cells.dim order the wrong way around, ## or the orientation of d$z incorrect . . . ## create the grid topology gt <- GridTopology(cellcentre.offset = c(d$x[1], d$x[2]), cellsize = c(diff(d$x[1:2])/2, diff(d$y[1:2])/2), cells.dim = dim(d$z)) ## create the SGDF grd.atts <- SpatialGridDataFrame(gt, list(depth = as.vector(d$z))) HTH Cheers, Mike _______________________________________________ R-sig-Geo mailing list [email protected] https://stat.ethz.ch/mailman/listinfo/r-sig-geo
