View source: R/GetRegionOfInterest.R
GetRegionOfInterest | R Documentation |
Create a spatial polygon describing the convex hull of a set of spatial points.
GetRegionOfInterest(x, y = NULL, alpha = NULL, width = NULL, ...)
x, y |
Coordinate vectors of a set of points.
Alternatively, a single argument |
alpha |
'numeric' number. Value of α, used to implement a generalization of the convex hull (Edelsbrunner and others, 1983). As α decreases, the shape shrinks. Requires that the alphahull and maptools packages are available. The alphahull package is released under a restrictive non-free software license. |
width |
'numeric' number. Buffer distance from geometry of convex hull. |
... |
Additional arguments to be passed to the |
An object of class 'SpatialPolygons'.
J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center
Edelsbrunner, H., Kirkpatrick, D.G. and Seidel, R., 1983, On the shape of a set of points in the plane: IEEE Transactions on Information Theory, v. 29, no. 4, p. 551–559.
Functions chull
and ashape
are used to calculate the convex hull and generalized convex hull, respectively.
Function checkPolygonsHoles
is used to identify polygon holes.
set.seed(123) n <- 50 x <- list("x" = stats::runif(n), "y" = stats::runif(n)) sp::plot(GetRegionOfInterest(x, width = 0.05), border = "blue", lty = 2) sp::plot(GetRegionOfInterest(x), border = "red", add = TRUE) sp::plot(GetRegionOfInterest(x, width = -0.05), lty = 2, add = TRUE) points(x, pch = 3) ## Not run: n <- 300 theta <- stats::runif(n, 0, 2 * pi) r <- sqrt(stats::runif(n, 0.25^2, 0.50^2)) x <- sp::SpatialPoints(cbind(0.5 + r * cos(theta), 0.5 + r * sin(theta)), proj4string = sp::CRS("+init=epsg:32610")) sp::plot(GetRegionOfInterest(x, alpha = 0.1, width = 0.05), col = "green") sp::plot(GetRegionOfInterest(x, alpha = 0.1), col = "yellow", add = TRUE) sp::plot(x, add = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.