The is the second in a series of articles on applying Map Algebra to solving problems. In the last installment, I discussed beginning to develop a habitat model as an example through which to apply map algebra. Now that there is a defined study area, it is time to dig in to the model itself.

# HABITAT MODELING: A BRIEF INTRO

After years of study, our wildlife biologist has compiled not only a detailed data set of jackalope observations, but has written a habitat preference description complete with measures of importance for each aspect of the habitat. We have all of our jackalope habitat preference data, described in narrative form, but how do we translate that into a cartographic model?

The text of the study identifies a number of geographic characteristics that make for attractive jackalope habitat. Taken alone, these features may not be enough to provide the proper environment, but where the features are in proximity to each other or overlap, the potential is higher for prime jackalope territory. To translate the conceptual model to a geographic one, we might follow these steps:

- Extract quantifiable qualities of the landscape and weights of importance for each from the text.
- Gather spatial data that is available for the study area and relates to the above qualities.
- “Ask quantitative questions” of the raw data to generate derivative spatial layers that represent the above qualities (using map algebra!).
- Combine the derived layers according to their weights of importance (weighted overlay) to create a cartographic model of the prime habitat.

The final result will be a graduated raster surface of habitat quality, with the highest scores representing prime habitat, middle scores representing marginal habitat, and low scores representing poor habitat.

## BREAKING DOWN THE JACKALOPE MODEL

The relevant information of the habitat preferences description can be summarized as follows:

- Near perennial sources of water, but not too near
- Flat to slightly sloped land, not too steep
- “Pockets” in rough terrain
- Areas of no more than 150m of elevation change
- Areas without a lot of human development
- Near edges of agricultural land

We’ll get into each of these in detail as we develop the model. The data sets that will be used to derive individual habitat preference layers are the National Elevation Dataset (NED), the National Hydrography Dataset (NHD), and the National Land Cover Dataset (NLCD). These are all available for all locations in the U.S. (as you might expect from the names) and can be downloaded from the USGS.

## WATERING HOLES

Generating the first habitat factor requires three steps: identifying perennial water sources, calculating proximity, and reclassifying the proximity to prepare it for the weighted overlay. The NHD has attribute data that identifies hydrologic flow lines as perennial, intermittent, ephemeral, etc., so we can query out the perennial streams easily.

Calculating the distance to these lines requires a map algebra operation called FocalProximity.

Stepping back: Dana Tomlin, in his book GIS and Cartographic Modeling, organizes map algebra operations into three main categories based on the way they interact with geographic data.

- Local – calculate a location’s value based on the values of that location in one or more layers
- Focal – calculate a location’s value based on its relationship to the cells around it on the same layer
- Zonal – calculate a location’s value based on where it falls in a second layer that defines zones of variable shape and size

We looked at a Focal operation in the last installment, FocalDistribution, which is closely related to a kernel density estimate and required several paragraphs of explanation. FocalProximity is one of the more elementary Focal operations. It essentially measures the distance from each raster cell to the specified spatial feature, and assigns the distance the cell. The ArcGIS Spatial Analyst extension refers to this as Euclidian Distance.

So we ran a FocalProximity on our perennial stream data, and the result ranges from distances of 0 meters to over 3,500 meters. Our distance to water habitat preference, “Near perennial sources of water, but not too near”, is more precisely defined as “between 100 and 1,000 meters from perennial water sources”. The next step is to identify those bands of distance by running a LocalReclassification operation.

“Reclassification” will organize the distance values into two categories: valid habitat and otherwise. We’ll represent these numerically as 1 and 0. For each raster cell, the operation will see if the value is between 100 and 1,000, and classify the cell appropriately. The result is our first derived habitat preference map – distance to water.

## FLATLANDERS

Jackalopes tend to prefer flat terrain, which is the second habitat preference we will derive. The habitat preference details specify the slope cutoff as 8 degrees.

FocalGradient is the operation we will use to calculate slope against the NED. This Focal operation derives a slope for a given location based on that location’s relationship to its immediate vicinity. The elevations of the surrounding raster cells are used to calculate a best-fit, three-dimensional plane. It is also possible to determine slope direction during this calculation, but we are only interested in the degree of the slope in this case.

The ArcGIS Spatial Analyst extension offers two options for slope calculation output: degrees and percent. Degrees measure the angle of the incline, whereas percent measures the ratio of rise over run. For many engineering applications, percent would be the more logical choice, but a jackalope cares nothing for this distinction.

Another option that ArcGIS provides is a Z factor, which allows for a unit conversion between horizontal and vertical coordinates. For example, you may find elevation data projected to a State Plane Coordinate System in US Feet, although the vertical units are meters. In this situation, you would want to use 3.28084 as the Z factor. The NED data uses meters for both the horizontal and vertical unites, so the default Z factor of 1 is acceptable.

We will reclassify the results of our FocalGradient operation as we did the proximity to water layer. For our slope layer, anything 8 or lower will receive a score of 1, and anything greater than 8 will become a 0. The result is our second habitat preference layer – flat areas.

There are still more layers to derive before we are ready for a weighted overlay calculation. In the next installment, we’ll look at some Focal operations that calculate a location’s values based on the location’s relationship to its extended vicinity, sometimes referred to as neighborhood operations.

## FOCALGRADIENT AND RECLASSIFICATION IN GEOTRELLIS

You can find the equivalent operations in GeoTrellis

- FocalGradient – Calculate FocalGradient using the op.focal.Slope operation
- LocalReclassify – The GeoTrellis team is working on a more general LocalReclassify operation for the 0.9 release, but in the current version (v 0.8), the If/Else operation can be used to set two integer values based on whether or not they satisfy a condition. This will work for the types of reclassifications performed above