qgis_extract_output function

Access processing output

Access processing output

These functions extract one output element from the result of qgis_run_algorithm(), potentially more than one in the case of qgis_extract_output_by_class(). An output element can be extracted based on its name, its position in the printed qgis_result object returned by qgis_run_algorithm(), or its class.

qgis_extract_output() is an alias to qgis_extract_output_by_name().

qgis_extract_output_by_name(x, name = "OUTPUT", first = TRUE) qgis_extract_output(x, name = "OUTPUT", first = TRUE) qgis_extract_output_by_position(x, which) qgis_extract_output_by_class(x, class, single = TRUE)

Arguments

  • x: A qgis_result object returned by qgis_run_algorithm().
  • name: The name of an output.
  • first: Logical. Should qgis_extract_output_by_name() fall back to the first output element if the default OUTPUT or output element is not available? Only takes effect if name is equal to OUTPUT or output, but not found.
  • which: The index of an output.
  • class: Character vector of classes. At least one class must be inherited by an element of x for that element to be selected.
  • single: Logical. Ensures the selection of a single output in qgis_extract_output_by_class(). The OUTPUT or output element is taken if available and on condition that it inherits a specified class; otherwise falls back to the first element that inherits a specified class.

Returns

A qgis_output* object.

Examples

result <- qgis_run_algorithm( "native:buffer", INPUT = system.file("longlake/longlake_depth.gpkg", package = "qgisprocess"), DISTANCE = 10 ) # the print() method of a qgis_result only prints its output elements: result # nevertheless, more elements are included: length(result) names(result) # extract the output element 'OUTPUT': qgis_extract_output(result)

See Also

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