Skip to content
Prev 845 / 29559 Next

SpatialGrid from matrix

Michael Sumner wrote:

            
Thanks, Mike, that's an excellent solution.

In this way g is of

 > class(g)
[1] "SpatialPixelsDataFrame"
attr(,"package")
[1] "sp"

meaning that it stores x and y coordinates. To save this
space, you could store it as SpatialGridDataFrame:
 > object.size(g)
[1] 283528
 > fullgrid(g)=T
 > object.size(g)
[1] 83476
 > class(g)
[1] "SpatialGridDataFrame"
attr(,"package")
[1] "sp"

A direct way to create a SpatialGridDataFrame without
using expand.grid() would use GridTopology() and
SpatialGridDataFrame(). You'd have to reorder x$z
for that, too.
--
Edzer