if(require(sp, quietly = TRUE)) {
library(sf)
data(meuse, package = "sp")
meuse <- st_as_sf(meuse, coords = c("x", "y"), crs = 28992,
agr = "constant")
meuse <- meuse[sample(1:nrow(meuse),10),]
transects <- sampleTransect(meuse, min.dist=200, max.dist=500,
type="regular", size=20)
plot(st_geometry(transects$transects))
plot(st_geometry(meuse), pch=19, cex=2, add=TRUE)
plot(st_geometry(transects$samples),
col="red", pch=19, add=TRUE)
} else {
cat("Please install sp package to run example", "\n")
}
Run the code above in your browser using DataLab