Skip to content
Prev 843 / 29559 Next

SpatialGrid from matrix

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:
[1] "matrix"
[1] 10000

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

Thanks,

Pedro Andrade