getLandingsFromTarget {roads} | R Documentation |
Get landing target points within harvest blocks
Description
Generate landing points inside polygons representing harvested area. There
are three different sampling types available: "centroid"
(default) returns
the centroid or a point inside the polygon if the
centroid is not (see sf::st_point_on_surface()
); "random"
returns a
random sample given landingDens
see
(sf::st_sample()
); "regular"
returns points on a regular grid with cell size sqrt(1/landingDens)
that intersect the polygon, or centroid if no grid points fall within the polygon.
Usage
getLandingsFromTarget(harvest, landingDens = NULL, sampleType = "centroid")
Arguments
harvest |
|
landingDens |
number of landings per unit area. This should be in the same units as the CRS of the harvest. Note that 0.001 points per m2 is > 1000 points per km2 so this number is usually very small for projected CRS. |
sampleType |
character. |
Details
Note that the landingDens
is points per unit area where the unit of
area is determined by the CRS. For projected CRS this should likely be a very
small number i.e. < 0.001.
Value
an sf simple feature collection with an ID
column and POINT
geometry
Examples
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)
}