qgis is automatically generated package which originates from qgisprocess and aims to provide calls and simple documentation for each QGIS functions available in core and the most important algorithm providers (GRASS GIS and Saga). The algorithms are automatically extracted from fresh install of latest QGIS version on Ubuntu with packages for GRASS and SAGA installed.
The package is highly experimental and things are quite likely to change a lot in the future. The definition of individual functions can change if it changes in the QGIS.
You can install the released version of qgis from GitHub with:
# install.package("remotes") ::install_github("JanCaha/r_package_qgis")remotes
The information about local installation are in a vignette
The names of the functions follow general pattern of
algorithm-provider_algorithm-id with only the native QGIS algorithms using
qgis algorithm provider instead of
The available providers are: 3d, gdal, native, qgis. The overall number of available algorithms is 344.
Every functions carries three boolean parameters that allow better utilization of these functions in R pipelines and reports. These are
.messages. The default setting of these variables is such that the calls are as silent as possible and create pretty much no output in R console at all.
.quiet (default values is
TRUE) is the same as in
qgisprocess::qgis_run_algorithm() only in
qgis the functions are silent by default while in
qgisprocess they are talkative.
.messages (default value is
FALSE) controls if messages produced by
qgisprocess (such as information about parameters not being set etc.) should be outputed or not.
.complete_output(default values is
TRUE) specifies whether whole QGIS process output should be returned or only first variable in it, which is usually the main output.
These three parameters can also be set as R session options using
options(qgis.quiet = TRUE),
options(qgis.messages = FALSE) and
options(qgis.complete_output = TRUE) to avoid the need to set them for every individual function call.
The package is not meant to be load directly as this would significant number of functions (<900). Instead the functions should be called as:
This allows you to show the help page for the function (at least in RStudio using the key shortcut F1).
This example uses
qgisprocess pipe ability to directly load output to R.
library(sf) #> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1; sf_use_s2() is TRUE <- st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE) nc <- qgis::qgis_buffer(INPUT = nc, buffered DISTANCE = 0.2, END_CAP_STYLE = "Flat") %>% st_as_sf() plot(buffered["NAME"])