|
5 | 5 | #' for a detailed description of the algorithms provided
|
6 | 6 | #' 'out of the box' on QGIS.
|
7 | 7 | #'
|
| 8 | +#' `qgis_run_algorithm()` accepts various R objects as algorithm arguments. |
| 9 | +#' Examples include an R matrix or data frame for the |
| 10 | +#' argument type 'matrix', R colors for the argument type 'color', |
| 11 | +#' sf or terra (SpatVector) objects for the argument type 'vector' and |
| 12 | +#' raster/terra/stars objects for the argument type 'raster', but there are many |
| 13 | +#' more. |
| 14 | +#' `qgis_run_algorithm()` preprocesses the provided objects into the format that |
| 15 | +#' QGIS expects for a given argument. |
| 16 | +#' |
| 17 | +#' For data objects in R that already exist as a stored file, it is best to |
| 18 | +#' instead provide the file path in order to prevent a superfluous file writing |
| 19 | +#' step from R, as QGIS expects a file path. |
| 20 | +#' However terra and stars objects can contain the file path as metadata: in |
| 21 | +#' these cases this path is retrieved from the R object and passed to QGIS; |
| 22 | +#' potential pitfalls are taken care of. |
| 23 | +#' |
| 24 | +#' Providing R objects that cannot be converted to the applicable argument type |
| 25 | +#' will lead to an error. |
| 26 | +#' |
| 27 | +#' @section Running QGIS models and Python scripts: |
| 28 | +#' QGIS models and Python scripts can be added to the Processing Toolbox in the |
| 29 | +#' QGIS GUI, by pointing at their corresponding file. |
| 30 | +#' This will put the model or script below the provider 'Models' or |
| 31 | +#' 'Scripts', respectively. |
| 32 | +#' Next, it is necessary to run [qgis_configure()] in R in order to make the |
| 33 | +#' model or script available to qgisprocess (even reloading the package won't |
| 34 | +#' detect it, since these providers have dynamic content, not tied to a |
| 35 | +#' plugin or to a QGIS version). |
| 36 | +#' You can check the outcome with [qgis_providers()] and |
| 37 | +#' [qgis_search_algorithms()]. |
| 38 | +#' Now, just as with other algorithms, you can provide the `model:<name>` or |
| 39 | +#' `script:<name>` identifier to the `algorithm` argument of |
| 40 | +#' `qgis_run_algorithm()`. |
| 41 | +#' |
| 42 | +#' As the output argument name of a QGIS model can have an R-unfriendly |
| 43 | +#' syntax, you may need to take the JSON parameter string from the QGIS |
| 44 | +#' processing dialog and feed the JSON string to the `.raw_json_input` argument |
| 45 | +#' of `qgis_run_algorithm()` instead of providing separate arguments. |
| 46 | +#' |
| 47 | +#' Although the 'qgis_process' backend also supports replacing the 'algorithm' |
| 48 | +#' parameter by the file path of a model file or a Python script, it is not |
| 49 | +#' planned to implement this in qgisprocess, as it would bypass argument |
| 50 | +#' preprocessing in R (including checks). |
| 51 | +#' |
8 | 52 | #' @family functions to run one geoprocessing algorithm
|
9 | 53 | #'
|
10 | 54 | #' @param algorithm A qualified algorithm name (e.g., `"native:buffer"`) or
|
|
0 commit comments