Bladeren bron

'pk_boundary_box' lisatud bbox-i tüübid.

Ardo Kubjas 5 jaren geleden
bovenliggende
commit
edc59495ad
2 gewijzigde bestanden met toevoegingen van 21 en 6 verwijderingen
  1. 11 4
      R/pk_boundary_box.R
  2. 10 2
      man/pk_bbox.Rd

+ 11 - 4
R/pk_boundary_box.R

@@ -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
   }
 }
+

+ 10 - 2
man/pk_bbox.Rd

@@ -4,10 +4,18 @@
 \alias{pk_bbox}
 \title{Piirkonna piirikast BB}
 \usage{
-pk_bbox(x = NULL)
+pk_bbox(x = NULL, type = 0)
 }
 \arguments{
 \item{x}{object of class sf, sfc or sfg.}
+
+\item{type}{num select value: 1-3
+\itemize{
+\item 0: Envelope (Bounding Box
+\item 1: Minimum Oriented Rectangle
+\item 2: Minimum Enclosing Circle
+\item 3: Convex Hull
+}}
 }
 \description{
 Funktsioon leiab etteantud piirkonnale piirikasti (boundary box). Tulemuseks on qgis_vektor.
@@ -17,7 +25,7 @@ Funktsioon leiab etteantud piirkonnale piirikasti (boundary box). Tulemuseks on
 ## class(pk)
 ## > [1] "sf" ...
 ##
-## pk_bbox(x = pk)
+## pk_bbox(x = pk, type = 1)
 ##
 ## End(**Not run**)
 }