README.md

qgis

Lifecycle:
experimental

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.

Installation

You can install the released version of qgis from GitHub with:

# install.package("remotes")
remotes::install_github("JanCaha/r_package_qgis")

The information about local installation are in a vignette vignette("local_instalation").

Functions names

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 native.

The available providers are: 3d, gdal, native, qgis. The overall number of available algorithms is 327.

Example

The package is not meant to be load directly as this would significant number of functions (<900). Instead the functions should be called as:

qgis::qgis_buffer()

This allows you to show the help page for the function (at least in RStudio using the key shortcut F1).

Example in the wild

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

fname <- system.file("shape/nc.shp", package="sf")
nc <- st_read(fname)
#> Reading layer `nc' from data source 
#>   `/home/runner/work/_temp/Library/sf/shape/nc.shp' using driver `ESRI Shapefile'
#> Simple feature collection with 100 features and 14 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
#> Geodetic CRS:  NAD27

buffered <- qgis::qgis_buffer(INPUT = nc, 
                              DISTANCE = 0.5, 
                              END_CAP_STYLE = "Flat") %>% 
  st_as_sf()
#> Argument `SEGMENTS` is unspecified (using QGIS default value).
#> Using `JOIN_STYLE = "Round"`
#> Argument `MITER_LIMIT` is unspecified (using QGIS default value).
#> Argument `DISSOLVE` is unspecified (using QGIS default value).
#> Using `OUTPUT = qgis_tmp_vector()`
#> Running qgis_process run 'native:buffer' \
#>   '--INPUT=/tmp/RtmpZFJWsB/file6fb534a7af68/file6fb5561b3d3b.gpkg' \
#>   '--DISTANCE=0.5' '--END_CAP_STYLE=1' '--JOIN_STYLE=0' \
#>   '--OUTPUT=/tmp/RtmpZFJWsB/file6fb534a7af68/file6fb57557d61e.gpkg'
#> QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-runner'
#> proj_create_from_database: Cannot find proj.db
#> proj_create_from_database: Cannot find proj.db
#> proj_create_from_wkt: Cannot find proj.db
#> proj_create_from_database: Cannot find proj.db
#> proj_get_authorities_from_database: Cannot find proj.db
#> 
#> ----------------
#> Inputs
#> ----------------
#> 
#> DISTANCE:    0.5
#> END_CAP_STYLE:   1
#> INPUT:   /tmp/RtmpZFJWsB/file6fb534a7af68/file6fb5561b3d3b.gpkg
#> JOIN_STYLE:  0
#> OUTPUT:  /tmp/RtmpZFJWsB/file6fb534a7af68/file6fb57557d61e.gpkg
#> 
#> 
#> 0...10...20...30...40...50...60...70...80...90...
#> ----------------
#> Results
#> ----------------
#> 
#> OUTPUT:  /tmp/RtmpZFJWsB/file6fb534a7af68/file6fb57557d61e.gpkg

plot(buffered)
#> Warning: plotting the first 10 out of 14 attributes; use max.plot = 14 to plot
#> all



JanCaha/r_package_qgis documentation built on Nov. 3, 2021, 1:41 a.m.