This repository documents a reproducible workflow for analysing spatial datasets related to benthic habitat disturbance using QGIS (3.28.15) and R (4.4.2). The workflow follows the methodological basis of the 2023 OSPAR BH3a Indicator – Physical Disturbance to Benthic Habitats, integrating spatial processing and disturbance calculations applied to the Scottish context.
- Overview
- Software Requirements
- Directory Setup
- Data Sources Required
- Environment Configuration
- Data Preparation
- QGIS Workflow 1
- R Workflow
- QGIS Workflow 2
- Contact Us
This project demonstrates how to process, analyse, and visualise spatial datasets used to calculate physical disturbance layers based on VMS (Vessel Monitoring System) data. The workflow switches between R for data processing and QGIS for spatial manipulation and map production.
Using the openly available source code and data from the OSPAR Convention's 2023 Quality Status Report BH3a indicator, ESS replicates the OSPAR process, but modifies the input layer relating to fishing, to simulate full closure to bottom-contact fishing vessels within the protected areas specified (in this case, within Scottish waters).
Further details about the methodology, assumptions and limitations are discussed in the ESS technical paper: https://environmentalstandards.scot/our-work/our-analytical-work/how-much-could-marine-protected-areas-contribute-to-good-environmental-status-development-of-a-practical-assessment-approach/
| Tool | Version | Notes |
|---|---|---|
| QGIS | 3.28.15 | Spatial processing & map production |
| R | 4.4.2 | Disturbance calculations, summarisation |
Where possible, alternative code has been provided for users who do not have access to QGIS - e.g. all models are provided both in .model3 and .py format.
The analysis has been carried out using publicly available open data sources.
The script: scripts/input-log.html provides details of each of the input layers used, and URLs for obtaining these.
The list includes - OSPAR public datasets, including cleaned VMS pressure layers (OSPAR 2023 Quality Status Report) - Scottish marine regions - Marine Protected Areas and Special Areas of Conservation (Scottish)
Suggested project structure:
project_root/
├── scripts/
├── outputs/
├── spatial/
├── interim-analysis/
├── .RProj
├── .Renviron
└── .Rprofile
Some spatial layers are contained within zip files and within a complex file structure. To keep the navigation simple within R, it is recommended that wherever these files are saved, a 'shortcut' directory path is set in the .Renviron path which allows only the .gpkg name to be used within the scripts.
e.g. ospar_geopackage <- "[direct path to gpkg folder set in .Renviron]/QSR2023_BH3_Disturbance_Layers_VMS.gpkg"These processes follow OSPAR’s 2023 BH3 methodology and depend on a suite of openly available spatial layers.
-
Clone repository
-
Update
.Renvironto reflect local file directory paths, using.Renviron.exampleas a template. -
Download the datasets listed in
input_files.html. Store files inDATA_DIR, or one of the other filepaths specified in.Renviron. -
Save
.Rprofilefrom.Rprofile.example
-- note that R Studio should be fully closed and re-opened to allow changes made in .Renviron and .Rprofile to take effect.
QGIS models are contained within the spatial folder.
QGIS tasks include:
- import spatial layers (specified in input_layers.html)
- identify relevant OSPAR layers and subregions
- intersect with Scottish marine regions
- identify relevant protected areas from 2015 Programme of Measures
- create layer which identifies all features which intersect with protected areas
- export layers produced during QGIS analysis to a geopackage within the relevant data directory you have specified in your .Renviron file.
- create look-up table to export for R analysis.
R tasks include:
- disturbance calculations
- aggregated pressure processing
- sensitivity layer integration
- summary statistics
- production of clean output tables
To carry out these tasks, run scripts in the following order:
-
Run
scripts/setup.R -
Run
scripts/disturbance_calculations.R -
Run
scripts/creating_summaries.R -
Run
scripts/broad_scale_habitats.R
Following the R analysis, QGIS is used to generate final outputs.
Steps:
-
Export
.csvoutputs from R. -
Import into QGIS.
-
Re-join new disturbance calculations with layers from geopackage (outputted in QGIS Workflow 1):
features_clipped_with_area_subregion_2018/features_clipped_with_area_subregion_2025layers -
Format to create visualisations (using
disturb_group_style.qml)
- Keep directory paths consistent.
- Ensure environment variables load correctly.
- Maintain consistent data types for join fields.
- Do not rename QGIS layers used in downstream processing.
If the above steps are not working, or you need some further information about the methodology used in this piece of analysis, please contact us.