R/qgis_bookmarkstolayer.R

Defines functions qgis_bookmarkstolayer

Documented in qgis_bookmarkstolayer

##' QGIS Algorithm provided by QGIS (native c++) Convert spatial bookmarks to layer (native:bookmarkstolayer). Converts stored spatial bookmarks to a polygon layer. This algorithm creates a new layer containing polygon features for stored spatial bookmarks.  The export can be filtered to only bookmarks belonging to the current project, to all user bookmarks, or a combination of both.
##'
##' @title QGIS algorithm - Convert spatial bookmarks to layer
##'
##' @param SOURCE `enum`  of `("Project bookmarks", "User bookmarks")` - Bookmark source. Number of selected option, e.g. '1'. Comma separated list of options, e.g. '1,3'.
##' @param CRS `crs` - Output CRS. CRS as an auth ID (e.g. 'EPSG:3111'). CRS as a PROJ4 string (e.g. 'PROJ4:…'). CRS as a WKT string (e.g. 'WKT:…'). Path to a layer. The CRS of the layer is used..
##' @param OUTPUT `sink` - Output. Path for new vector layer.
##' @param ... further parameters passed to `qgisprocess::qgis_run_algorithm()`
##' @param .complete_output logical specifying if complete out of `qgisprocess::qgis_run_algorithm()` should be used (`TRUE`) or first output (most likely the main) should read (`FALSE`). Default value is `TRUE`.
##' @param .quiet logical specifying if parameter `.quiet` for `qgisprocess::qgis_run_algorithm()` Default value is `TRUE`.
##' @param .messages logical specifying if messages from `qgisprocess::qgis_run_algorithm()` should be printed (`TRUE`) or not (`FALSE`). Default value is `FALSE`.
##'
##' @details
##' ## Outputs description
##' * OUTPUT - outputVector - Output
##'
##'
##' @export
##' @md
##' @importFrom qgisprocess qgis_run_algorithm

qgis_bookmarkstolayer <- function(SOURCE = qgisprocess:::qgis_default_value(), CRS = qgisprocess:::qgis_default_value(), OUTPUT = qgisprocess:::qgis_default_value(),..., .complete_output = .complete_output_option(), .quiet = .quiet_option(), .messages = .message_option()) {

  check_algorithm_necessities("native:bookmarkstolayer")

  if (.messages){
    output <- qgisprocess::qgis_run_algorithm("native:bookmarkstolayer", `SOURCE` = SOURCE, `CRS` = CRS, `OUTPUT` = OUTPUT,..., .quiet = .quiet)
  } else {
    suppressMessages(
      output <- qgisprocess::qgis_run_algorithm("native:bookmarkstolayer", `SOURCE` = SOURCE, `CRS` = CRS, `OUTPUT` = OUTPUT,..., .quiet = .quiet)
      )
  }

  if (.complete_output) {
    return(output)
  }
  else{
    qgisprocess::qgis_extract_output(output, "OUTPUT")
  }
}
JanCaha/r_package_qgis documentation built on April 4, 2024, 8:10 p.m.