qgisprocess

R package to use QGIS processing algorithms

https://github.com/r-spatial/qgisprocess

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (21.3%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

R package to use QGIS processing algorithms

Basic Info
Statistics
  • Stars: 213
  • Watchers: 16
  • Forks: 21
  • Open Issues: 9
  • Releases: 5
Created over 5 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Zenodo

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%",
  dpi = 300
)
```

# qgisprocess




[![CRAN status](https://www.r-pkg.org/badges/version/qgisprocess)](https://CRAN.R-project.org/package=qgisprocess)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8260794.svg)](https://doi.org/10.5281/zenodo.8260794)
[![R-CMD-check](https://github.com/r-spatial/qgisprocess/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-spatial/qgisprocess/actions/workflows/R-CMD-check.yaml)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Codecov test coverage](https://codecov.io/gh/r-spatial/qgisprocess/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-spatial/qgisprocess/tree/main)


The goal of **qgisprocess** is to provide an R interface to the geoprocessing algorithms of [QGIS](https://qgis.org), a popular and open source desktop geographic information system (GIS) program.
The package is a re-implementation of functionality provided by the archived [RQGIS](https://cran.r-project.org/package=RQGIS) package, which was partially revived in the [RQGIS3](https://github.com/r-spatial/RQGIS3) package.

## Installation

### qgisprocess

To install the latest CRAN release, just run:

```{r eval=FALSE}
install.packages("qgisprocess")
```

You can install the development version from GitHub with:

```{r eval=FALSE}
# install.packages("remotes")
remotes::install_github("r-spatial/qgisprocess")
```

### QGIS

The **qgisprocess** package wraps the [standalone `qgis_process` command-line utility](https://docs.qgis.org/latest/en/docs/user_manual/processing/standalone.html), which is available in QGIS >= 3.16.

The package is meant to support _current_ QGIS releases, i.e. both the latest and the long-term release.
Although older QGIS releases are not officially supported, it may work since QGIS 3.16.
Installation instructions for all platforms are available at .

If a recent version of QGIS isn't available for your OS, you can use the [Geocomputation with R Docker image](https://github.com/geocompx/docker/pkgs/container/docker) with QGIS installed (`docker pull ghcr.io/geocompx/docker:qgis`).
See the vignette on 'getting started' for more information.

### Package configuration

If the automatic configuration fails (or if you have more than one QGIS installation and would like to choose which one is used), you can set `options(qgisprocess.path = "path/to/qgis_process")`.
Specify the `qgisprocess.path` option in your `.Rprofile`, to make your choices persistent between sessions.
You can run `qgis_configure()` to reconfigure the package, or just `qgis_configure(use_cached_data = TRUE)` to see the gritty details!

```{r}
library(qgisprocess)
```

## Functionality

Most functions start with the `qgis_` prefix, so that functions can be found more easily using tab completion.

The main function is `qgis_run_algorithm(algorithm = , ...)`.
It specifies the geoprocessing algorithm to be called with a `"provider:algorithm"` formatted identifier, e.g. `"native:convexhull"` or `"gdal:hillshade"`, and it passes the algorithm arguments as R function arguments.

Additional functions are provided to discover available geoprocessing algorithms, retrieve their documentation, handle processing results, manage QGIS plugins, and more.

Spatial layers can be passed to `qgis_run_algorithm()` as file paths but also as [sf](https://r-spatial.github.io/sf/), [stars](https://r-spatial.github.io/stars/), [terra](https://rspatial.github.io/terra/) or [raster](https://cran.r-project.org/package=raster) objects.

A structured overview of functions is available at .
To get started, read the 'getting started' vignette and use the [cheat sheets](https://r-spatial.github.io/qgisprocess/articles/)!

Note that R package [**qgis**](https://github.com/JanCaha/r_package_qgis) extends on **qgisprocess** by providing a separate R function for each geoprocessing algorithm.
In addition, it makes the QGIS algorithm documentation available in the corresponding R function documentation.

### Example

The following example demonstrates the [buffer](https://docs.qgis.org/latest/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#buffer) algorithm in action.

```{r buffer, out.width='60%'}
input <- sf::read_sf(system.file("shape/nc.shp", package = "sf"))

result <- qgis_run_algorithm(
  "native:buffer",
  INPUT = input,
  DISTANCE = 1,
  DISSOLVE = TRUE
)

result

output_sf <- sf::st_as_sf(result)
plot(sf::st_geometry(output_sf))
```

### Some tips

You can search for algorithms with `qgis_search_algorithms()` (string matching with regex).

```{r}
qgis_search_algorithms(algorithm = "buffer", group = "[Vv]ector")
```

You can read the help associated with an algorithm using `qgis_show_help()`.

```{r eval=FALSE}
qgis_show_help("native:buffer")
```

A full list of available algorithms is returned by `qgis_algorithms()`.

```{r}
qgis_algorithms()
```

It may also be useful to run an algorithm in the QGIS GUI to determine how the various input values are translated to string processing arguments.
This can be done using the 'Advanced' dropdown, by copying either the `qgis_process` command string or the JSON string:

![](man/figures/copy_as_json.png)

Note that the JSON string can be passed directly to `qgis_run_algorithm()`!

## Code of Conduct

Please note that the qgisprocess project is released with a [Contributor Code of Conduct](https://r-spatial.github.io/qgisprocess/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

## More information

### Presentations

- useR! 2024: [slides](https://florisvdh.github.io/user-2024-qgisprocess/)
- FOSS4G 2023: [slides](https://florisvdh.github.io/foss4g-2023-qgisprocess/) & [video](https://www.youtube.com/watch?v=Qt5DzWThWqI)
- FOSS4G 2021: [slides](https://dewey.dunnington.ca/slides/qgisprocess2021/) & [video](https://www.youtube.com/watch?v=iA0OQ2Icn6Y&t=1912s)

### In the wild

(Draft)

Following case studies have used the package:

- \. Source code: \.

_If you used the package in your work and would like to see it referenced here, then give a shout in issue [#211](https://github.com/r-spatial/qgisprocess/issues/211) or make a pull request!_

### Further reading

- A [paper](https://journal.r-project.org/archive/2017/RJ-2017-067/index.html) on the original RQGIS package published in the R Journal
- A [discussion](https://github.com/r-spatial/discuss/issues/41) about options for running QGIS from R that led to this package
- The [pull request](https://github.com/qgis/QGIS/pull/34617) in the QGIS repo that led to the development of the `qgis_process` command-line utility

Owner

  • Name: r-spatial
  • Login: r-spatial
  • Kind: organization

For packages raster, terra, dismo & geosphere visit the rspatial github organisation (mind the missing '-')

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you use this software, please cite it using these metadata.
title: "R package qgisprocess: use QGIS processing algorithms"
authors:
- given-names: Dewey
  family-names: Dunnington
  affiliation: Voltron Data
  orcid: 0000-0002-9415-4582
- given-names: Floris
  family-names: Vanderhaeghe
  affiliation: Research Institute for Nature and Forest (INBO)
  orcid: 0000-0002-6378-6229
- given-names: Jan
  family-names: Caha
  orcid: 0000-0003-0165-0606
- given-names: Jannes
  family-names: Muenchow
  orcid: 0000-0001-7834-4717
keywords:
- R
- package
- QGIS
contact:
- given-names: Floris
  family-names: Vanderhaeghe
  affiliation: Research Institute for Nature and Forest (INBO)
  orcid: 0000-0002-6378-6229
doi: ~
license: GPL-3.0-or-later
repository-code: https://github.com/r-spatial/qgisprocess/
type: software
abstract: R package 'qgisprocess' provides seamless access
  to the 'QGIS' (https://qgis.org) processing
  toolbox using the standalone 'qgisprocess' command-line utility. Both native and
  third-party (plugin) processing providers are supported. Beside referring data sources
  from file, also common objects from 'sf', 'terra' and 'stars' are supported. The
  native processing algorithms are documented by QGIS.org (2024)
  https://docs.qgis.org/latest/en/docs/usermanual/processing_algs/.
identifiers:
- type: url
  value: https://r-spatial.github.io/qgisprocess/
version: 0.4.1

GitHub Events

Total
  • Issues event: 3
  • Watch event: 15
  • Issue comment event: 10
  • Push event: 1
  • Pull request event: 1
  • Fork event: 4
  • Create event: 1
Last Year
  • Issues event: 3
  • Watch event: 15
  • Issue comment event: 10
  • Push event: 1
  • Pull request event: 1
  • Fork event: 4
  • Create event: 1

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 69
  • Total pull requests: 52
  • Average time to close issues: 5 months
  • Average time to close pull requests: 24 days
  • Total issue authors: 28
  • Total pull request authors: 10
  • Average comments per issue: 4.42
  • Average comments per pull request: 2.63
  • Merged pull requests: 44
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 5
  • Average time to close issues: 22 days
  • Average time to close pull requests: 11 days
  • Issue authors: 5
  • Pull request authors: 3
  • Average comments per issue: 5.5
  • Average comments per pull request: 2.0
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • florisvdh (16)
  • jannes-m (7)
  • paleolimbot (7)
  • Robinlovelace (5)
  • JanCaha (4)
  • ThierryO (3)
  • umor (3)
  • Nowosad (3)
  • ocedesb (2)
  • antagis (2)
  • cmber (1)
  • ambarja (1)
  • barnabasharris (1)
  • gavg712 (1)
  • aloboa (1)
Pull Request Authors
  • florisvdh (28)
  • paleolimbot (15)
  • jannes-m (7)
  • JanCaha (6)
  • ambarja (4)
  • Robinlovelace (3)
  • SpatLyu (2)
  • Nowosad (1)
  • loreabad6 (1)
  • gavg712 (1)
Top Labels
Issue Labels
feature (4) planned (2) QGIS (2) CRAN (2) bug (1) provider (1) upkeep (1) documentation (1) help wanted :heart: (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 813 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 2
    (may contain duplicates)
  • Total versions: 10
  • Total maintainers: 1
proxy.golang.org: github.com/r-spatial/qgisprocess
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
cran.r-project.org: qgisprocess

Use 'QGIS' Processing Algorithms

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 813 Last month
Rankings
Stargazers count: 2.4%
Forks count: 3.6%
Average: 13.6%
Downloads: 14.4%
Dependent repos count: 19.6%
Dependent packages count: 28.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • glue * imports
  • jsonlite * imports
  • processx >= 3.5.2 imports
  • rappdirs * imports
  • rlang * imports
  • stringr * imports
  • tibble * imports
  • vctrs * imports
  • withr * imports
  • covr * suggests
  • fs * suggests
  • raster * suggests
  • rgdal * suggests
  • sf * suggests
  • stars * suggests
  • terra * suggests
  • testthat * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • crazy-max/ghaction-chocolatey v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
.github/workflows/pkgdown.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite