Automating ArcGIS-processes

_images/arcpy-logo.png

In this section we will take a tour on how to use Python in ArcGIS using arcpy -module. For doing the ArcPy-exercises you need to work on a computer where ArcGIS is installed. ArcGIS is not an open source or freely available software such as Quantum GIS or the other Python tools that we have been using. However, it is widely used software in many places (companies, public sector etc.) which is the reason why we give this introduction how you can automatize ArcGIS workflows using Python scripting and the ArcPy-module.

Learning objectives

The aim is to learn the basics how the ArcGIS tools can be run using ArcPy-functions in Python, and how we can create a graphical user interface for your custom scripts in the ArcToolbox (.tbx -file).

After completing the ArcPy-lesson and exercises you should be able to:

  • Create a simple user interface using ArcGIS ToolBox.
  • Run ArcGIS-tools from Python using the ArcPy-module.
  • Find and know how to read the ArcPy documentation online.

Case: Processing species distribution data

The source data has been downloaded from the IUCN Red List of Threatened Species website. We will be working with the species distribution data of different subspecies of Damselfish (Pomacentridae). In practice, we will incrementally create an ArcGIS Python tool that converts the individual Damselfish species distribution Polygons into raster layers (.tif). Such processing step has been included in the methodology for prioritizing global conservation areas based on the occurrence of endangered species (Pouzols et al. 2014).

Download source data for the exercise

Download the source data for the arcpy-exercise from this link

_images/Datazipdownload.png

The zip-file contains a shapefile DAMSELFISH_distributions.shp and related files. Extract the zip file (right click and select “Extract All”) to your local folder:

_images/DamselfishFiles.png
_images/damselfish-simple-map.PNG

Source data for this exercise: the Damselfish distribution shapefile visualized based on the attribute “binomial”.

Familiarize yourself with the data

  • What attributes can you find in the attribute table?
  • What is the spatial extent of the data?
  • What is the coordinate reference system?

You will notice that the CRS of the shapefile is WGS84 and the unit of this reference system are in degrees (not in meters!). This is important to know when rasterizing the dataset. The following conversion table will help you to adjust the output resolution of the rasterization process

arc degrees (in decimals) kilometers (at equator)
0.79968 100
0.4 20
0.1 10
0.00833 1