|
|
@@ -2,6 +2,11 @@
|
|
|
#'
|
|
|
#' Funktsioon leiab etteantud piirkonnale piirikasti (boundary box). Tulemuseks on qgis_vektor.
|
|
|
#' @param x object of class sf, sfc or sfg.
|
|
|
+#' @param type num select value: 1-3
|
|
|
+#' - 0: Envelope (Bounding Box
|
|
|
+#' - 1: Minimum Oriented Rectangle
|
|
|
+#' - 2: Minimum Enclosing Circle
|
|
|
+#' - 3: Convex Hull
|
|
|
#' @keywords piirkond, boundarybox
|
|
|
#' @export
|
|
|
#' @examples
|
|
|
@@ -9,14 +14,15 @@
|
|
|
#' ## class(pk)
|
|
|
#' ## > [1] "sf" ...
|
|
|
#' ##
|
|
|
-#' ## pk_bbox(x = pk)
|
|
|
+#' ## pk_bbox(x = pk, type = 1)
|
|
|
#' ##
|
|
|
#' ## End(**Not run**)
|
|
|
-pk_bbox <- function(x = NULL) {
|
|
|
- if (!is.null(x) && sf::st_is_valid(x)) {
|
|
|
+pk_bbox <- function(x = NULL, type = 0) {
|
|
|
+ if (!is.null(x) && sf::st_is_valid(x) && type %in% (seq(0:3)-1)) {
|
|
|
result <- qgisprocess::qgis_run_algorithm(
|
|
|
- algorithm = "native:boundingboxes",
|
|
|
+ algorithm = "qgis:minimumboundinggeometry",
|
|
|
INPUT = x,
|
|
|
+ TYPE = type,
|
|
|
.quiet = TRUE
|
|
|
)
|
|
|
# sf::read_sf(qgisprocess::qgis_output(result, "OUTPUT"))
|
|
|
@@ -25,3 +31,4 @@ pk_bbox <- function(x = NULL) {
|
|
|
NULL
|
|
|
}
|
|
|
}
|
|
|
+
|