edzer / sp

Classes and methods for spatial data

Home Page:http://edzer.github.io/sp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bbox issue

nephentes7 opened this issue · comments

I am trying to run spsample, using country boundaries as spatial object (x).
However, I need sample points/and grid covering a slighly larger AOI (of e.g. kind of buffering), using the same cellsize (to get overlapping points).
Thus, I have changed only the bbox, creating a new matrix as below (nm2).
However, the results, (points2) does not 'cover' the new bbox. Why? Maybe I am missing something...THANKS

"bb: bounding box of the sample domain; setting this to a smaller value leads to sub-region sampling"

points1 <- spsample(study_area, type = "hexagonal", cellsize = size)
points2 <- spsample(study_area, type = "hexagonal", bb= bbox(nm2), cellsize = size)


size <- 0.179
#original bbox of study area
minori <- c(-11.485695, 4.352916)
maxori <- c(-7.365113, 8.551790)
m <- cbind(minori, maxori)
rnameso <- c("x","y")
cnameso <- c("min", "max")
nm <- matrix(m,nrow=2,byrow=FALSE,dimnames=list(rnameso,cnameso))
nm

#new bbox ('buffering')
min <- c(-13.485695, 6.352916)
max <- c(-9.365113, 10.551790)

m2 <- cbind(min, max)
rnames <- c("x","y")
cnames <- c("min", "max")
nm2 <- matrix(m2,nrow=2,byrow=FALSE,dimnames=list(rnames,cnames))
nm2