Run QGIS algorithms. See the QGIS docs for a detailed description of the algorithms provided 'out of the box' on QGIS (versions >= 3.14).

qgis_run_algorithm(
  algorithm,
  ...,
  PROJECT_PATH = NULL,
  ELLIPSOID = NULL,
  .raw_json_input = NULL,
  .quiet = FALSE
)

Arguments

algorithm

A qualified algorithm name (e.g., "native:filedownloader") or a path to a QGIS model file.

...

Named key-value pairs as arguments for each algorithm. Features of rlang::list2() are supported. These arguments are converted to strings using as_qgis_argument().

PROJECT_PATH, ELLIPSOID

Global values for QGIS project file and ellipsoid name for distance calculations.

.raw_json_input

The raw JSON to use as input in place of ....

.quiet

Use TRUE to suppress output from processing algorithms.

Examples

if (has_qgis()) {
  qgis_run_algorithm(
    "native:buffer",
    INPUT = system.file("longlake/longlake_depth.gpkg", package = "qgisprocess"),
    DISTANCE = 10
  )
}
#> Argument `SEGMENTS` is unspecified (using QGIS default value).
#> Using `END_CAP_STYLE = "Round"`
#> Using `JOIN_STYLE = "Round"`
#> Argument `MITER_LIMIT` is unspecified (using QGIS default value).
#> Argument `DISSOLVE` is unspecified (using QGIS default value).
#> Using `OUTPUT = qgis_tmp_vector()`
#> JSON input ----
#> {
#>   "inputs": {
#>     "INPUT": "/home/runner/work/_temp/Library/qgisprocess/longlake/longlake_depth.gpkg",
#>     "DISTANCE": 10,
#>     "END_CAP_STYLE": 0,
#>     "JOIN_STYLE": 0,
#>     "OUTPUT": "/tmp/Rtmp3vBw7O/file62229100e9/file622273d62358.gpkg"
#>   }
#> }
#> 
#> Running qgis_process --json run 'native:buffer' -
#> 
#> <Result of `qgis_run_algorithm("native:buffer", ...)`>
#> List of 1
#>  $ OUTPUT: 'qgis_outputVector' chr "/tmp/Rtmp3vBw7O/file62229100e9/file622273d62358.gpkg"