knitr::opts_chunk$set( fig.align = "center", collapse = TRUE, comment = "#>" ) # knitr::opts_chunk$set(fig.pos = '!h')
knitr::opts_chunk$set(fig.pos = 'H')
Most common landscape metrics are calculated on a raster-basis. However, sometimes landscape information come along in vector-formats. For the calculation of landscape metrics, one must perform a vector-to-raster-transformation often resulting in a loss of information. In VLSM we implemented various landscape metrics based on vector data in R
. However, sometimes it is easier to process data with only few clicks using a desktop GIS. Therefore, we created compatible R scripts being accessible in the open-source desktop GIS QGIS
.
In the following, a quick manual on how to use these functions in QGIS
. If you want to use these functions via R
, please refer to here.
The open-source desktop GIS QGIS
enabele the possibility to integrate R-scripts. However, QGIS
does not except the standard .R
-format, instead we developped R-scripts which are compartible to QGIS
and can easily be loaded in with only few clicks. You can find the VLSM R-scripts for QGIS
here.
We tested our implementation on Windows with the following software and packages:
Before integrating R
into QGIS
, one must have installed R
(download-page). Our implementation was tested using R version 3.5.2 (2018-12-20) -- "Eggshell Igloo". Furthermore, we recommend to install the necessairy packages sf, sp, raster, link2GI, rgrass7, RSAGA, dplyr, and of course VLSM via R
.
QGIS 3.6 Noosa: We recommend QGIS
> 3.x which can easily be installed by the OSGeo-installer. In QGIS
one must enable the option for R-processing, first. An comprehensive instruction can be found here, or here. It may be that R
is not visible or included in the setting menu. If that is the case the Processing R Provider
must installed as plug-in (see here for help).
Note: One can set R's
library directory in QGIS. Installing necessairy packages may be better done inside R
.
When the setup of the setting was successfull, the QGIS
desktop should look similiar to the following screenshot:
# LOAD REQUIRED LIBRARIES pacman::p_load(VLSM, magick) # LOAD THE DATA OF THE PACKAGE: data(VLSM_QGIS, package = "VLSM") image_Intro <- magick::image_read(VLSM_QGIS$image_intro) image_Mesh <- magick::image_read(VLSM_QGIS$image_mesh) image_Urban_Sprawl <- magick::image_read(VLSM_QGIS$image_ffe) # 
```{R, messages = FALSE, invisible = TRUE, echo=FALSE, fig.cap="QGIS setting to access R functions", out.width = '100%'} plot(image_Intro)
# 3 Calculation of Landscape Metrics We use Corine Land Cover (CLC) data, which are in detailed explained in the [R-vignette](https://github.com/raff-k/VLSM/blob/master/vignettes/vignette_R.pdf) of this package. ## 3.1 Example 1: Effective Mesh Size The *effective mesh size* is calculated with the tool _Mesh_. The output delivers a table with the corresponding mesh sizes [ha]. ```r plot(image_Mesh)
The Urban Sprawl is calculated with the tool Urban Sprawl. The output delivers a table with the corresponding degree of urban sprawl [%], and a geometry showing the grid lines, which were used for calculation.
plot(image_Urban_Sprawl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.