[R-sig-Geo] sp::makegrid() bbox does not fully cover object
Mark Payne
markpayneatwork at gmail.com
Mon Jan 27 11:40:20 CET 2014
Hi,
I have been playing with the makegrid function, and discovered
something interesting. For example, consider the domain of the meuse
data
> data(meuse)
> coordinates(meuse) <- ~x+y
> bbox(meuse)
min max
x 178605 181390
y 329714 333611
Now make a grid, and check its domain
> grd <- makegrid(meuse,cellsize=100)
> head(grd)
x1 x2
1 180000 330000
2 180100 330000
3 180200 330000
4 180300 330000
5 180400 330000
6 180500 330000
> t(sapply(grd,range)) %Transposed to be in the same format as bbox()
[,1] [,2]
x1 180000 181300
x2 330000 333600
Note that the domain of the grid does not fully cover the meuse data
set. I won't call this a bug, but it was certaintly unexpected - I was
expecting the full domain to be covered by the grid - and this created
quite some problems around the edges of the polygon I am working with.
Is this by design? Could the addition of a full.coverage argument be
useful here, to give the user extra flexibility?
Mark
More information about the R-sig-Geo
mailing list