I am trying to sample a raster (pixel values= 1 or NA, where 1 means opportunity as defined for my research).
The specs of my raster are
class : RasterLayer
dimensions : 15838, 3808, 60311104 (nrow, ncol, ncell)
resolution : 60, 60 (x, y)
extent : 2402625, 2631105, 788651, 1738931 (xmin, xmax, ymin, ymax)
crs : +proj=utm +zone=43 +ellps=WGS84 +units=m +no_defs
source : <folder> not including in this post
names : <name> not including in this post
values : 1, 1 (min, max)
I want to sample 30 random points in all pixels with value=1 for further analyses and research.
sampled_points <-raster::sampleRandom(above raster, size = 30 ,na.rm=TRUE, xy=TRUE, sp= TRUE)
But the Error in .bboxCoords(coords) : nrow(coords) > 0 is not TRUE is present. I have used sampleRandom() multiple times before in other analyses an dhave not encountered this problem. How do I solve this problem?
table(yourraster)say for itself? – Spacedman Sep 02 '20 at 16:33