i would like to cover an area defined by a bbox lat long
coordinates with a raster
of gps points 1 km apart. Currently i generate 2000
points for a bboxbbox=8.9771580802,47.2703623267,13.8350427083,50.5644529365
the following way:
as.data.frame(cbind(runif(2000,8.9771580802 ,13.8350427083),runif(2000,47.2703623267,50.5644529365)))
Since runif
is a normal distribution, i think i just have to increase the amount of points to cover the whole area the way i need it.
Is there a more clever way to do it?
How many points would i need?
UPDATE
I thought i maybe can use the package sp
to do the job but im still not realy familiar the with settings:
longitudes <- c(8.9771580802, 13.8350427083)
latitudes <- c(47.2703623267, 50.5644529365)
bounding_box <- matrix(c(longitudes, latitudes), nrow = 2, byrow = TRUE, dimnames = list(NULL, c("min", "max")))
projection <- "+proj=longlat"
sp_box<-Spatial(bbox = bounding_box, proj4string = CRS(projection))
p_sample<-spsample(sp_box, 10000, type="regular")
If i understand correctly this will give me a number of points evenly distributed within my coordinates. spsample
has an option for cell size but i dont grasp it yet.
BR
Andreas