Skip to content
stijnwcmc edited this page Aug 8, 2019 · 20 revisions

The Quality Assurance of the World Database on Protected Areas

This document is to guide you through the usage of the Quality Assurance of the World Database on Protected Areas.


Author: Stijn den Haan

Supervisor: Yichuan Shi

Bioinformatics internship • UNEP-WCMC • 10 June - 9 August 2019


Background

Installation requirements

  • ArcGIS Pro 2.3.1 or later
  • Python 3.6 or later (included in ArcGIS Pro 2.3.1)
  • Python packages required: - ArcPy
    • Pandas 0.25
    • NumPy 1.16.4
    • OpenPyXL 2.6.1

Note: installing Anaconda is not required. Refrain from using any other Conda installation than the one that comes with ArcGIS Pro's installation.

Setup your Python environment

This is not essential to run the QA toolbox, but it is highly recommended. Doing this will allow you to updated Python packages (see list above) and prevent incompatibility errors.

  • Clone ArcGIS Pro's default Python environment called arcgispro-py3
  1. Open ESRI's Python Command Prompt - this comes with ArcGIS Pro's installation. In Windows, see folder ArcGIS in the Start menu.

  2. In the terminal, the first line should look similar to this:

     (arcgispro-py3) C:\Users\[UserName]\AppData\Local\ESRI\conda\envs\
    
  3. Enter the following in the command-prompt:

        # Display Python environments present
        conda info --envs

        # Become root (obtain administrator permissions)
        conda activate root
        
        # If that yields an error, use:
        activate root
        
        # Clone the default ArcPy environment
        conda create --name [NameOfNewEnvironment] --clone arcgispro-py3
        
        # Activate the new environment
        conda activate [NameOfNewEnvironment]
        
        # If that yields an error, use:
        activate [NameOfNewEnvironment]
        
        # View all installed packages
        conda list
        
        # Install required packages, e.g. pandas
        conda install [nameOfPackage]
  • Make the new Python environment ArcGIS Pro's default environment

In ArcGIS Pro, go to Settings --> Python. This will display the Python Package Manager. Access 'Manage Environments', select the environment you just created, press OK and restart ArcGIS Pro.

You are now ready to use the WDPA Quality Assurance toolbox.

Usage

Walkthrough: importing and using the WDPA QA toolbox in ArcGIS Pro

  1. Download the WDPA QA toolbox from this GitHub repository
  2. Unzip the file in a folder of your choosing
  3. Open a (non-empty / empty) project in ArcGIS Pro
  4. On the ribbon, select Insert --> Toolbox --> Add Toolbox
  5. Go to the folder where you unzipped the toolbox, select the toolbox (with red icon), and press 'OK'
  6. Open the Catalog pane --> Toolboxes --> The WDPA QA toolbox should now be visible.
  7. Expand the toolbox, so that the embedded scripts become visible.
  8. Right-click the script to run (e.g. for polygons or points), click Open, and specify the input table (feature class attribute table) to be checked, and the output directory.
  9. Click Run, and click 'View Details' if you wish to see the progress
  10. The Excel output will be present in the previously specified output directory.

For developers: Creating the WDPA QA toolbox

  1. Open a blank project in ArcGIS Pro
  2. On the ribbon, select Insert --> Toolbox --> New Toolbox
  3. Specify the name of the toolbox
  4. Once created, the toolbox will be present in the Catalog, under Toolboxes.
  5. Right-click the created toolbox --> New --> Script
  6. In tab 'General', specify the name and label, then point to a script containing the main functions (poly.py or point.py).
  7. Ensure boxes 'Import script' and 'Store tool with relative path' are checked
  8. In tab 'Parameters', add two parameters to specify the input type and the output folder
    • Label: WDPA polygon, Data Type: Feature Class, Type: Required, Direction: Input
    • Label: Output folder, Data Type: Folder, Type: Required, Direction: Input
  9. Repeat steps 5-8 for another script if required (i.e. poly.py or point.py)
  10. Finally, store the toolbox in a folder along with the WDPA folder that contains the QA scripts and compress this folder. Subsequently, wherever this folder is uncompressed and the toolbox is used, the toolbox will be in the same folder as the WDPA QA scripts. This makes the QA portable.

Troubleshooting common errors

1. "Permission denied"

The Excel workbook with QA results is still open. Close the workbook and try again.

2. "Wrong input" - expect polygons where it should be points

Function descriptions

The functions have two names: one that is present in the script, and one that is displayed in the Excel output.


4.2. Find inconsistent fields for the same WDPAID


Rule: if the WDPAID is the same among a group of WDPA_PIDs, then related fields (e.g. ISO3) must be the same for the entire group. Output the WDPA_PIDs that do not adhere to this rule.

4.2.a. Inconsistent NAME - dif_name_same_id - inconsistent_name_same_wdpaid

Find WDPA_PIDs that share the same WDPAID, but have inconsistencies in field NAME.

4.2.b. Inconsistent ORIG_NAME - dif_orig_name_same_id - inconsistent_orig_name_same_wdpaid

Find WDPA_PIDs that share the same WDPAID, but have inconsistencies in field ORIG_NAME.


4.3 Find invalid values in fields


Rule: for a number of fields, only a set number of values are allowed. Output the WDPA_PIDs that do not adhere to this rule.

4.3.a. Invalid PA_DEF - ivd_pa_def - invalid_pa_def

Find WDPA_PIDs that have a value unequal to 1 in field PA_DEF.

4.3.b. Invalid DESIG_ENG - international - ivd_desig_eng_international - invalid_desig_eng_international

Find WDPA_PIDs whose DESIG_ENG is unequal to:

  • Ramsar Site, Wetland of International Importance
  • UNESCO-MAB Biosphere Reserve
  • World Heritage Site (natural or mixed)

While DESIG_TYPE = 'International'

4.3.c. Invalid DESIG_ENG - regional - ivd_desig_eng_regional - invalid_desig_eng_regional

Find WDPA_PIDs whose DESIG_ENG is unequal to:

  • Baltic Sea Protected Area (HELCOM)
  • Specially Protected Area (Cartagena Convention)
  • Marine Protected Area (CCAMLR)
  • Marine Protected Area (OSPAR)
  • Site of Community Importance (Habitats Directive)
  • Special Protection Area (Birds Directive)
  • Specially Protected Areas of Mediterranean Importance (Barcelona Convention)

While DESIG_TYPE = 'Regional'

Clone this wiki locally