QMarxan Toolbox

Overview

The QMarxan Toolbox is a QIGS plugin that provides a set of processing tools for QGIS 2.14 and above for Marxan data preparation, export to Marxan and analysis of results. The underlying algorithms for the QMarxan Toolbox come from the now retired QMarxanZ project. The current version is 0.3.4.

Fundamental to the design of the QMarxan Toolbox was speed and simplicity. Unlike the QMarxan plugin for QGIS 1.x, none of the calculated values are attached to the planning unit layer. In the QMarxan Toolbox, calculated values of features inside planning units are written to individual text files. This approach speeds processing and simplifies use.

This document is not however a substitute for Marxan training. For information on training see the PacMARA website.

The most recent version of this plug-in can be found on the Apropos QGIS Plug-in Repository. Add the following URL to your repository, refresh and you can install.

https://aproposinfosystems.com/qgis-repo/plugins.xml

Use Overview

The design of the QMarxan Toolbox is for the following workflow:

  1. Create a directory for project and within it a subfolder for your feature calculation results.
  2. Create your planning unit layer
  3. Use the Data Preparation tools to calculate the line, point, polygon and raster contents of features in your study area
  4. Create your first scenario folder and then the contents within it with the Create Input File and Folders tool.
  5. Create the rest of your input files using Export to Marxan tools
  6. Manually edit the spec.dat file to set targets
  7. Run and calibrate Marxan by hand or with Zone Cogito
  8. Use the Report Features tool to assess the conservation feature compositions of groups of planning units as needed

Tool Specifics

Data Preparation

The QMarxan Toolbox provides give data preparation tools:

  1. Create Planning Unit Layer
  2. Lines in Planning Units
  3. Points in Planning Units
  4. Polygons in Planning Units
  5. Rasters in Planning Units
  6. Table Values in Planning Units

Create Planning Unit Layer

This tool creates a planning unit layer and has the following inputs:

  • Grid extent - The extent of the area you want to use for your planning unit grid
  • Grid CRS - The projection for your grid shapefile
  • Output polygons shape - Choose hexagons or squares
  • Define polygon size by - Choose either side length or area
  • Enter polygon size value - This is entered in projection units or projection units squared depending on if you choose to define your area by side length or area
  • Clip new planning unit layer to this layer - You can select a shapefile to limit the extent of your planning unit grid
  • Planning unit layer name - The name and location of the shapefile you will create

Lines in Planning Units

This tool calculates the contribution of line features inside individual planning unit polygons and has the following inputs:

  • Planning Unit Layer - The planning unit layer you want to use
  • Planning Unit Id Field - The planning unit id field name in the planning unit layer
  • Line Source Layer - The line layer representing this feature
  • Calculation Method - Calculate planning unit values using either the measured length, a weighted length or a field value.
  • Output Format - If you have multiple classes of linear features in a single layer you can calculate their individual lengths by choosing the multiple fields option. The single field option allows you to calculate values using the weighted or field methods.
  • Calculation Field - The field to be used either for weighting or assigning values in the single field output format or for identifying the class of feature for multiple field outputs.
  • Intersection Operation - If one or more features are in a planning unit, how do you want to combine them. Options are: sum, mean, max, min, count or presence.
  • Output Directory - This is the folder or directory on your system where the calculation results will be written. It is important that the file names are unique and that all calculations are written to the same folder.
  • File Name or Prefix - The name of the output file name in the case of single field outputs or the prefix to be combined by numerical values for writing multiple field outputs.

Points in Planning Units

This tool calculates the contribution of point features inside individual planning unit polygons and has the following inputs:

  • Planning Unit Layer - The planning unit layer you want to use
  • Planning Unit Id Field - The planning unit id field name in the planning unit layer
  • Point Source Layer - The point layer representing this feature
  • Calculation Method - Calculate planning unit values using either the measured length, a weighted length or a field value.
  • Output Format - If you have multiple classes of linear features in a single layer you can calculate their individual lengths by choosing the multiple fields option. The single field option allows you to calculate values using the weighted or field methods.
  • Calculation Field - The field to be used either for weighting or assigning values in the single field output format or for identifying the class of feature for multiple field outputs.
  • Intersection Operation - If one or more features are in a planning unit, how do you want to combine them. Options are: sum, mean, max, min, count or presence.
  • Output Directory - This is the folder or directory on your system where the calculation results will be written. It is important that the file names are unique and that all calculations are written to the same folder.
  • File Name or Prefix - The name of the output file name in the case of single field outputs or the prefix to be combined by numerical values for writing multiple field outputs.

Polygons in Planning Units

This tool calculates the contribution of polygon features inside individual planning unit polygons and has the following inputs:

  • Planning Unit Layer - The planning unit layer you want to use
  • Planning Unit Id Field - The planning unit id field name in the planning unit layer
  • Polygon Source Layer - The polygon layer representing this feature
  • Calculation Method - Calculate planning unit values using either the measured length, a weighted length or a field value.
  • Output Format - If you have multiple classes of linear features in a single layer you can calculate their individual lengths by choosing the multiple fields option. The single field option allows you to calculate values using the weighted or field methods.
  • Calculation Field - The field to be used either for weighting or assigning values in the single field output format or for identifying the class of feature for multiple field outputs.
  • Intersection Operation - If one or more features are in a planning unit, how do you want to combine them. Options are: sum, mean, max, min, count or presence.
  • Calculate using rasters - When large vector files are intersected, this can take a long time. The QMarxan Toolbox provides an option to convert to rasters to speed processing times. The options are to use rasters for large files only, always or never.
  • Set pixel size for raster calculations - When converting to rasters the size of the pixels affect the precision of the measurements. Very small pixels are precise but slow, large pixels are fast but crude but fast. Select a pixel size in projection units that make sense given the size of your planning units and the data you are measuring.
  • Output Directory - This is the folder or directory on your system where the calculation results will be written. It is important that the file names are unique and that all calculations are written to the same folder.
  • File Name or Prefix - The name of the output file name in the case of single field outputs or the prefix to be combined by numerical values for writing multiple field outputs.

Rasters in Planning Units

This tool calculates the contribution of raster values inside individual planning unit polygons and has the following inputs:

  • Planning Unit Layer - The planning unit layer you want to use
  • Planning Unit Id Field - The planning unit id field name in the planning unit layer
  • Raster Source Layer - The raster layer representing this feature
  • Calculation Method - Calculate planning unit values using either the measured length, a weighted length or a pixel value.
  • Output Format - If you have multiple classes of linear features in a single layer you can calculate their individual lengths by choosing the multiple fields option. The single field option allows you to calculate values using the weighted or pixel methods.
  • Intersection Operation - If one or more features are in a planning unit, how do you want to combine them. Options are: sum, mean, max, min, count or presence.
  • Output Directory - This is the folder or directory on your system where the calculation results will be written. It is important that the file names are unique and that all calculations are written to the same folder.
  • File Name or Prefix - The name of the output file name in the case of single field outputs or the prefix to be combined by numerical values for writing multiple field outputs.

Table Values in Planning Units

This tool translates the values for a planning unit stored in a table or shapefile into a qmd file for use with the QMarxan Toolbox and has the following inputs:

  • Planning Unit Layer - The planning unit layer you want to use
  • Planning Unit Id Field - The planning unit id field name in the planning unit layer
  • Calculation Field - The field with the measured values in it.
  • Output Directory - This is the folder or directory on your system where the calculation results will be written. It is important that the file names are unique and that all calculations are written to the same folder.
  • File Name - The first part of the output file name.

Export to Marxan

The QMarxan Toolbox provides give export tools:

  1. Create Input File and Folders
  2. Export Boundary File
  3. Export Feature File
  4. Export Features vs Planning Units
  5. Export Planning Unit File

Create Input File and Folders

This tool creates the input, output and pu folders as well as the input.dat file and has the following inputs:

  • Select or create directory for input.data and input and output folders - Select the folder you want to use for your Marxan project here.

Export Boundary File

This tool creates the boundary file that describes what planning units are next to other planning units and the weight of the boundary relationship between them. Input values for this tool are:

  • Planning Unit Layer - The planning unit layer for this Marxan project.
  • Planning Unit Id Field - The planning unit id field name in the planning unit layer.
  • Calculation Method - If you want to use their actual length of the boundaries, then use the measured option. If you want to use some weighted value of the measured length times a field value, choose weighted. If you want to use a field value choose the last option of field.
  • Boundary Length Field - If you are using the Weighted or Field methods, select the field you want to use here.
  • When boundary field values differ use the - If you are using a weighted or field method, it is possible that the values from one PU's field will not match the values of the adjacent PU. You can choose three options of how to treat this. First, use the mean value, second the maximum and third the minimum field value before either weighting or direct use with the field method.
  • Value of boundary length for planning units on the edge should be - Some Marxan practitioners suggests there is merit is excluding or assigning half values to planning unit boundaries at the edge of the planning area. This option enables this choice. Best empirical evidence suggests that using a consistent value on all boundaries gives the least biased result if all planning units are the same size; use the field option with a consistent value to do this.
  • Export precision rounding - Since shapefiles do not store topological information this tool compares overlapping line segments to identify adjacency. Select a suitable rounding value based on your knowledge of your study area; usually a precision of 1 is suitable.
  • Folder for bound.dat file - This is normally the input subfolder inside your Marxan project folder.

Export Feature File

This tool reads the output directory you used for your calculations and creates a spec.dat file for you to edit manually. It is important not to change the feature names in the spec.dat file or this function will not work correctly. Inputs for this tool are:

  • Select folder with calculated results - The folder where you wrote all the calculations using the Data Preparation tools is selected here.
  • Folder for spec.datfile - This is normally the input subfolder inside your Marxan project folder.

Export Features vs Planning Units

This tool reads the output directory you used for your calculations and creates the puvsp.dat and puvsp_sporder.dat files to compliment the spec.dat file. It is important not to change the feature names in the spec.dat file or this function will not work correctly. Inputs for this tool are:

  • Select folder with calculated results - The folder where you wrote all the calculations using the Data Preparation tools is selected here.
  • Folder for puvsp.dat and puvsp_sporder.dat files - This is normally the input subfolder inside your Marxan project folder.

Export Planning Unit File

This tool creates the planning unit file that describes planning units in respect to costs and status. Inputs for this tool are:

  • Planning Unit Layer - The planning unit layer for this Marxan project.
  • Planning Unit Id Field - The planning unit id field name in the planning unit layer.
  • Planning Unit Status Field - The field that contains the planning unit status values is selected here.
  • Planning Unit Cost Field - The field that contains the planning unit costs values is selected here.
  • Folder for pu.dat file - This is normally the input subfolder inside your Marxan project folder.

Results Analysis

At this time the QMarxan Toolbox only has a single results analysis tool

Report Features for Selected Planning Units

This tool calculates feature contents of arbitrarily selected planning units. To use this tool select the planning units of interest using QGIS and then open this tool and run it. This tool will create a comma separated file you can open in an spreadsheet program to look at the results. The file will contain the following values:

  • Marxan Feature Id - Each feature is assigned a numerical id in the spec.dat file.
  • Marxan Feature Name - Each feature is assigned a name in the spec.dat file, which would have been the field name in the source file.
  • Feature Count - The number of times this feature was recorded in the selected planning units is listed here.
  • Total Planning Unit Count - The total number of planning units.
  • Occurrence Percent - The percent occurrence of the feature in the planning units.
  • Feature Value Total (sum) - The total amount of the feature in the selected planning units.

Input values for this tool are:

  • Planning Unit Layer - The planning unit layer with the planning unit id fieldĀ 
  • Planning Unit Id Field - The name of the field with the planning unit id is selected here.
  • Marxan Input Folder - The Marxan input folder is selected here.
  • Report Output File - Assign a name and location for your report name here.