|
|
@@ -1,32 +0,0 @@
|
|
|
-#' Piirkonna piirikast BB
|
|
|
-#'
|
|
|
-#' Funktsioon leiab etteantud piirkonnale piirikasti (boundary box). Tulemuseks on 'qgis_vector'.
|
|
|
-#' @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.
|
|
|
-#' @return The object with class 'qgis_object'.
|
|
|
-#' @seealso [qgisprocess::qgis_run_algorithm()], [qgisprocess::qgis_output()], [ruut::get_config()]
|
|
|
-#' @keywords piirkond, boundarybox
|
|
|
-#' @export
|
|
|
-#' @examples
|
|
|
-#' \dontrun{
|
|
|
-#'
|
|
|
-#' class(pk)
|
|
|
-#' # > [1] "sf" ...
|
|
|
-#'
|
|
|
-#' pk_bbox(x = pk, type = 1)
|
|
|
-#'
|
|
|
-#' }
|
|
|
-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 = "qgis:minimumboundinggeometry",
|
|
|
- INPUT = x,
|
|
|
- TYPE = type,
|
|
|
- .quiet = TRUE
|
|
|
- )
|
|
|
- # sf::read_sf(qgisprocess::qgis_output(result, "OUTPUT"))
|
|
|
- result
|
|
|
- } else {
|
|
|
- NULL
|
|
|
- }
|
|
|
-}
|