Skip to content
Prev 6853 / 29559 Next

sample.Spatial question

On Thu, 12 Nov 2009, Edzer Pebesma wrote:

            
Yes, the outcome reported is based on the cellsize= argument not being 
given, so it defaults to:

area = prod(apply(bb, 1, diff))/n
dx = sqrt(area)/(sqrt(3)/2)

If you use:

rand.points <- spsample(SPDF, cellsize=80, offset=c(0.3, 0.6),
   type="hexagonal")

then

dim(coordinates(rand.points))

is

[1] 23  2

but it needs some playing around with both cellsize= and offset=. Using 
cellsize= rather than n= may be sensible. For sample.Polygon which is the 
method being used here, offset= defaults to runif(2), so should be set to 
a known value to anchor the grid.

Roger