The qgisprocess package is a wapper around the 'qgis_process' command line tool distributed with QGIS (>=3.14). These functions use heuristics to detect the location of the 'qgis_process' executable. If the configuration fails or you have more than one QGIS installation, you can set options(qgisprocess.path = "path/to/qgis_process") or the R_QGISPROCESS_PATH environment variable (useful on CI). On Linux the 'qgis_process' executable is generally available on the user's PATH, on MacOS the executable is within the QGIS*.app/Contents/MacOS/bin folder, and on Windows the executable is named qgis_process-qgis.bat or qgis_process-qgis-dev.bat and is located in Program Files/QGIS*/bin or OSGeo4W(64)/bin.

qgis_run(args = character(), ..., env = qgis_env(), path = qgis_path())

has_qgis()

assert_qgis(action = abort)

qgis_configure(quiet = FALSE, use_cached_data = FALSE)

qgis_unconfigure()

qgis_version(query = FALSE, quiet = TRUE)

qgis_path(query = FALSE, quiet = TRUE)

qgis_query_path(quiet = FALSE)

qgis_use_json_output(query = FALSE)

qgis_use_json_input()

qgis_env()

qgis_query_version(quiet = FALSE)

qgis_query_algorithms(quiet = FALSE)

Arguments

args

Command-line arguments

...

Passed to processx::run().

env

A list() of environment variables. Defaults to qgis_env().

path

A path to the 'qgis_process' executable. Defaults to qgis_path().

action

An action to take if the 'qgis_process' executable could not be found.

quiet

Use FALSE to display more information about the command, possibly useful for debugging.

use_cached_data

Use the cached algorithm list and path found when configuring qgisprocess during the last session. This saves some time loading the package.

query

Use TRUE to refresh the cached value.

Value

The result of processx::run().

Examples

if (has_qgis()) qgis_path()
#> [1] "qgis_process"
if (has_qgis()) qgis_version()
#> [1] "3.26.1-Buenos Aires"
if (has_qgis()) qgis_algorithms()
#> # A tibble: 348 × 27
#>    provi…¹ provi…² algor…³ algor…⁴ algor…⁵ provi…⁶ can_c…⁷ depre…⁸ group has_k…⁹
#>    <chr>   <chr>   <chr>   <chr>   <chr>   <chr>   <lgl>   <lgl>   <chr> <lgl>  
#>  1 3d      QGIS (… 3d:tes… tessel… Tessel… 3d      TRUE    FALSE   Vect… FALSE  
#>  2 gdal    GDAL    gdal:a… aspect  Aspect  gdal    TRUE    FALSE   Rast… FALSE  
#>  3 gdal    GDAL    gdal:a… assign… Assign… gdal    TRUE    FALSE   Rast… FALSE  
#>  4 gdal    GDAL    gdal:b… buffer… Buffer… gdal    TRUE    FALSE   Vect… FALSE  
#>  5 gdal    GDAL    gdal:b… buildv… Build … gdal    TRUE    FALSE   Rast… FALSE  
#>  6 gdal    GDAL    gdal:b… buildv… Build … gdal    TRUE    FALSE   Vect… FALSE  
#>  7 gdal    GDAL    gdal:c… clipra… Clip r… gdal    TRUE    FALSE   Rast… FALSE  
#>  8 gdal    GDAL    gdal:c… clipra… Clip r… gdal    TRUE    FALSE   Rast… FALSE  
#>  9 gdal    GDAL    gdal:c… clipve… Clip v… gdal    TRUE    FALSE   Vect… FALSE  
#> 10 gdal    GDAL    gdal:c… clipve… Clip v… gdal    FALSE   FALSE   Vect… FALSE  
#> # … with 338 more rows, 17 more variables: help_url <chr>, name <chr>,
#> #   requires_matching_crs <lgl>, short_description <chr>, tags <list>,
#> #   provider_can_be_activated <lgl>, default_raster_file_extension <chr>,
#> #   default_vector_file_extension <chr>, provider_is_active <lgl>,
#> #   provider_long_name <chr>, provider_name <chr>,
#> #   supported_output_raster_extensions <list>,
#> #   supported_output_table_extensions <list>, …
#> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
qgis_configure()
#> getOption('qgisprocess.path') was not found.
#> Sys.getenv('R_QGISPROCESS_PATH') was not found.
#> Trying 'qgis_process' on PATH...
#> Success!
#> QGIS version: 3.26.1-Buenos Aires
#> Saving configuration to '~/.cache/R-qgisprocess/cache-0.0.0.9000.rds'
#> Metadata of 348 algorithms queried and stored in cache.
#> Run `qgis_algorithms()` to see them.
#> - Using JSON for input serialization
#> - Using JSON for output serialization