doPlots <- interactive()
demoScen <- prepExData(demoScen)
polys <- demoScen[[1]]$landings.poly[1:2,]
# Get centroid
outCent <- getLandingsFromTarget(polys)
if(doPlots){
plot(sf::st_geometry(polys))
plot(outCent, col = "red", add = TRUE)
}
# Get random sample with density 0.1 points per unit area
outRand <- getLandingsFromTarget(polys, 0.1, sampleType = "random")
if(doPlots){
plot(sf::st_geometry(polys))
plot(outRand, col = "red", add = TRUE)
}
# Get regular sample with density 0.1 points per unit area
outReg <- getLandingsFromTarget(polys, 0.1, sampleType = "regular")
if(doPlots){
plot(sf::st_geometry(polys))
plot(outReg, col = "red", add = TRUE)
}
Run the code above in your browser using DataLab