Description Usage Arguments Value Examples
Convex or concave hull polygons from spatial points
1 2 | hull_polygon(occ_pr, hull_type = "convex", concave_distance_lim = 5000,
verbose = TRUE)
|
occ_pr |
SpatialPoints* object containing geographic points to be used to create hull polygons. This spatial object must be projected to a system with the argument "+units=m". |
hull_type |
(character) type of hull polygons to be created. Available options are: "convex" and "concave". Default = "convex". |
concave_distance_lim |
(numeric) distance, in meters, to be passed to the
length_threshold parameter of the |
verbose |
(logical) whether or not to print messages about the process. Default = TRUE. |
A SpatialPolygons object with the hull polygon. If the number of points in occ_pr is 1 or 2 a SpatialPointsDataFrame object is returned.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # data
data("occ_p", package = "rangemap")
# preparing spatial points
occ <- as.data.frame(unique(occ_p))
WGS84 <- sp::CRS("+init=epsg:4326")
occ_sp <- sp::SpatialPointsDataFrame(coords = occ[, 2:3], data = occ,
proj4string = WGS84)
# reprojecting
LAEA <- LAEA_projection(spatial_object = occ_sp)
occ_pr <- sp::spTransform(occ_sp, LAEA)
# convex hull polygon
cvx_hull <- hull_polygon(occ_pr, hull_type = "convex")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.