Skip to contents

A qgis_result object is a list that, next to the output elements, also contains other elements that can be useful in scripting. Several of these can be extracted with convenience functions: the exit status of the process, standard output and standard error of 'qgis_process', arguments passed to 'qgis_process'.

Usage

qgis_result_status(x)

qgis_result_stdout(x)

qgis_result_stderr(x)

qgis_result_args(x)

Arguments

x

A qgis_result object returned by qgis_run_algorithm().

Value

  • A number in case of qgis_result_status().

  • A string in case of qgis_result_stdout() and qgis_result_stderr().

  • A list in case of qgis_result_args().

See also

Other topics about programming or debugging utilities: qgis_run(), qgis_tmp_file(), qgis_unconfigure(), qgis_using_json_input()

Other topics about accessing or managing processing results: qgis_as_raster(), qgis_as_terra(), qgis_clean_result(), qgis_extract_output(), st_as_sf, st_as_stars

Examples

result <- 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).
#> Argument `SEPARATE_DISJOINT` is unspecified (using QGIS default value).
#> Using `OUTPUT = qgis_tmp_vector()`

qgis_result_status(result)
#> [1] 0
stdout <- qgis_result_stdout(result)
cat(substr(stdout, 1, 335))
#> {
#>   "algorithm_details": {
#>     "can_cancel": true,
#>     "deprecated": false,
#>     "group": "Vector geometry",
#>     "has_known_issues": false,
#>     "help_url": null,
#>     "id": "native:buffer",
#>     "name": "Buffer",
#>     "requires_matching_crs": false,
#>     "short_description": null,
#>     "tags": [
#>       "buffer",
#>       "grow",
#>       "fixed",
qgis_result_stderr(result)
#> [1] ""
qgis_result_args(result)
#> $INPUT
#> [1] "/home/runner/work/_temp/Library/qgisprocess/longlake/longlake_depth.gpkg"
#> 
#> $DISTANCE
#> [1] 10
#> 
#> $END_CAP_STYLE
#> [1] 0
#> 
#> $JOIN_STYLE
#> [1] 0
#> 
#> $OUTPUT
#> [1] "/tmp/Rtmp7nb1k0/file2b044d88ac6c/file2b042d2c3e8f.gpkg"
#>