PCRaster Tools Plugin
Processing provider for the PCRaster analysis tools for QGIS. The plugin allows execution of PCRaster operations directly from QGIS.
The plugin is available in the QGIS Python Plugins Repository here. It can also be installed directly from QGIS via the Plugins tool. Note that you have to install PCRaster too (instructions below).
Building from source for offline install can be done by downloading the source code and running command:
in the main directory. The produced zip file can then be installed in QGIS from Plugins tool in the Install from zip window.
PCRaster is a powerful package of software for map algebra and environmental dynamic modelling. The main applications of PCRaster are found in environmental modelling: geography, hydrology, ecology to name a few. An extensive set of raster operations is available: several point operations (analytical and arithmetical functions, Boolean operators, operators for relations, comparison, rounding, field generation etc.), neighbourhood operations for calculations in moving windows (highpass filtering, edge filtering, moving averages, etc.), area operations for calculations within specified areas (for instance soil groups), operations for the calculation of cost paths. In the PCRaster package a rich suite of geomorphological and hydrological functions is available. These include functions for visibility analysis, catchment analysis and routing of transport (drainage) of material in a catchment using interactively generated local drain direction maps and transport (routing) operations. These operations are made available in the QGIS Processing Toolbox through this plugin.
Settings for the plugin
Before you can use the plugin you need to install PCRaster. This can be done on Windows (OSGeo4W installer or conda), Linux (build from source or conda) or MacOS (conda).
On Windows you can install PCRaster with the OSGeo4W installer. Alternatively you can install PCRaster and QGIS in conda (see next section).
- Run the OSGeo4W setup
- Choose Advanced Install, click Next
- Choose Install from Internet, click Next
- Select the root install directory or keep the defaults, click Next
- Select local package directory or keep the defaults, click Next
- Select your internet connection, click Next
- Choose one of the download sites, click Next
- In the Select Packages window search for pcraster
- Click the arrows icon to change from skip to a PCRaster version to install.
- Click Next to complete the installation.
Watch this video:
Linux, MacOS and Windows (conda)
PCRaster is available on conda-forge and can be installed using conda. Supported platforms are Linux, MacOS and Windows. QGIS and PCRaster need to be installed in the same conda environment. Note that the newest supported QGIS version is 3.18.3 with Python 3.9.
First thing you need to do is to install the Conda packaging system. Two distributions install Conda: Anaconda and Miniconda.
- Download Anaconda or Miniconda installers for your system and follow the instructions to install it.
- Create a new conda environment and install QGIS and PCRaster by typing the following command in the terminal (e.g. Anaconda prompt on Windows):
conda create --name <name_of_the_environment> -c conda-forge python=3.9 qgis pcraster
- Enter the environment by typing
conda activate <name_of_the_environment>
qgisto run QGIS
- Install the plugin
For Apple silicon (M series) you need to specify the osx-64 channel in Step 2:
conda create --name <name_of_the_environment> -c conda-forge/osx-64 python=3.9 qgis pcraster
Watch this video:
Build PCRaster from source on Linux
In this Gist by Tim Sutton you can read how to build PCRaster on Fedora from source.
For building PCRaster on Ubuntu you can type the following commands in the terminal window:
sudo apt install libboost-all-dev libqt5charts5-dev libxerces-c-dev libncurses-dev cmake-curses-gui libqt5opengl5-dev pybind11-dev git clone --recursive https://github.com/pcraster/pcraster.git cd pcraster && mkdir build && cd build cmake -G"Unix Makefiles" -D CMAKE_BUILD_TYPE=Release -DPCRASTER_BUILD_TEST=OFF .. make -j4 sudo make install echo "export PYTHONPATH=$PYTHONPATH:/usr/local/python" >> ~/.bash_profile
After rebooting you can test the installation with the following commands:
import pcraster as pcr pcr.__version__
Free course at GIS OpenCourseWare: Hydrological Analysis and Modelling using PCRaster
Found bugs or need help?
The PCRaster community has a mailing list. The pcraster-info mailing list is a discussion platform for users of PCRaster and related software. The PCRaster Research&Development team also uses the list to announce new software releases. We recommend that every PCRaster user becomes a member of the list. Subscribe here.
Issues related to the PCRaster package can be reported on the PCRaster GitHub repository following these instructions.
Issues related to the PCRaster Tools plugin for QGIS can be reported in the PCRaster Tools Github repository.