[R-sig-Geo] SpatialGrid from matrix

pedro at dpi.inpe.br pedro at dpi.inpe.br
Mon Mar 13 19:08:36 CET 2006


Hi,

I would like to know how to create a SpatialGrid(DataFrame) using 
directly one matrix as input. I tried to use grid.topology (as shown in 
            the manual), but I got a memory allocation problem (it 
tries to alloc a
vector of size 390Mb using the following script:

require(splancs)
data(bodmin)
x= kernel2d(as.points(bodmin), bodmin$poly, h0=2, nx=100, ny=100)
require(sp)
g=expand.grid(x$x,x$y,x$z)

The last line gives the following error:
Error: cannot allocate vector of size 390625 Kb

Just to show that the data is not so large:
> class(x$z);length(x$z)
[1] "matrix"
[1] 10000

Is there any other way to create a SpatialGrid without using so much memory?

Thanks,

Pedro Andrade




More information about the R-sig-Geo mailing list