Exercise 1 - Mapping linkages with min-cost-max-flow subset centrality

In this exercise, we will be using network flow analysis to analyze habitat connectivity for wolves between central Idaho and Yellowstone National Park. The example is taken from Carroll et al. (2011).
Please refer to the manual for a description of the analysis method, which is an algorithm termed min-cost-max-flow. This algorithm requires two types of data, representing respectively habitat suitability and land cost. The method identifies the set of paths that allows maximum flow between two areas at minimum total cost. In this example, wolf habitat suitability is derived from data on land cover, productivity, slope, roads, and human population, while cost is based on a simple model that assigns greater cost to private vs. public lands.
Habitat data is input to the Connectivity Analysis Toolkit (CAT) in the form of an .asc or ASCII file produced in a GIS software such as ArcGIS. From the ArcGIS Desktop interface (ArcMap or Arc Toolbox), you can use the From Raster toolset's 'Raster to ASCII' function to convert the information in a raster dataset such as a grid to an .asc file. Alternately, from the arc command prompt of ArcGIS Workstation, you can use the gridascii command: gridascii <input grid> <output .asc>
1) Hexmaps Tab
Refer to p. 16 of the Toolkit manual for a description of the Hexmaps Tab.
In the directory ‘Exercise_1’, there are 2 files named habitat.asc and cost.asc.
There is also a subdirectory named OtherFiles that contains copies of all the files we will generate during the analysis process. Please refer to these if your attempt to create these files is unsuccessful.
We will create two hexagon (.hxn) files from these .asc files.
In the ‘Hexmaps’ tab, select the directory Exercise_1 and the file habitat.asc
Set ‘hexagon area’ to 500 hectares. Set the name of the output to habitat5
Press Run to generate the hxn file.
Repeat the process to create cost5 from cost.asc
The hxn files are a binary format only usable within the CAT (and Hexsim).
However, the program created several associated files for each hxn file.
Shapefiles are also produced by the Toolkit when the .asc file is initially converted to the hxn format. These shapefiles allow the text file of results to be represented spatially.
Add the shapefile habitat5.shp to an ArcMap composition. We will use this composition later.
Open the file habitat5.crd in a text editor (e.g., Notepad). This file contains the x,y coordinates of the centroids of each hexagon. This data can be used to constrain analyses to not consider flow between those nodes that are greater than a maximum distance apart. For example, if 800 km was the maximum recorded dispersal distance for wolves, we might want to perform at least one set of analyses excluding node pairs greater than 800 km apart.
2) Graphs Tab
Refer to p. 18 of the Toolkit manual for a description of the Graphs Tab.
We will create the LGF (LEMON graph format) input file we will use in the subsequent connectivity analysis.
Press the + tab above the upper box and add the file habitat5.hxn to the upper box  (Hexmap Source File).
Press the + tab above the lower box  and add the file cost5.hxn to the lower box  (Cost Hexmap).
Set graph type as LGF Undirected.
Set the Output file name as habcost5.lgf
Leave checked ‘No Data Value -9999’.
Set the decimals of ‘convert scores to integer values’ as 1 (this is appropriate based on the range of values [1-1000] in the input .asc files).
Press Run.
Examine the file habcost5.lgf in a text editor. Note how the node and arc sections of this file are created and attributed.
3) Connectivity Tab - Refer to p. 21 of the Toolkit manual for a description of the Connectivity Tab.
A subset file is needed that lists the hexagons (nodes) between which flow is mapped. This is typically created using an ArcMap composition which displays the shapefile, by identifying the hex_id values of hexagons at the endpoints of the linkage path. We have created a subset file beforehand, a textfile named sourcetarget.txt.
Open sourcetarget.txt in a text editor to see the format required for the subset file.
In the Connectivity Tab, set the Function as ‘Minimum Cost Flow’.
Browse and locate the graph file, habcost5.lgf.
Leave input file type as ‘generic data’.
Browse and select sourcetarget.txt as the input file for this field.
Browse and name the output file: mcfhabcost5.tab.
Press Run to run the analysis.
The progress of the analysis will be displayed in the ‘Output’ tab.
4) Working with the CAT output files
In order to display the results spatially, the text file (or files if several different analyses were run) will need to be joined to the 'hex_id' field of the shapefile created during the hxn file generation process.
Open the file mcfhabcost5.tab in a text editor. Notice the line at the beginning naming the fields:
“HEX_ID, VALUE”. This information allows the output to be joined to the HEX_ID field in the shapefile.
Open your ArcMap composition.
Right-click on the shapefile habitat5 (in the list of datasets).
Select ‘Joins and Relates” and then ‘Join’.
In the menu box that appears,
In menu item #1 (join field in shapefile), choose the field HEX_ID.
In #2 (choose table), select the textfile mcfhabcost5.tab.
In #3 (join field in table), choose the field HEX_ID.
Choose the default option ‘Keep All Records’.
Run the Join.
Now you will be able to go to the Symbology tab of the layer ‘habcost5’ and display the results of the CAT analysis using a graduated color scheme. You should choose to make hexagons with zero flow be transparent in the map composition.
Warning: the display of a joined field is slow in ArcMap. If you prefer, the data in the textfile can be permanently joined to the shapefile to make future display of the results more rapid. Alternately, you can produce a raster grid from the shapefile using ArcGIS's "polygon to raster" tool.

The help manual was created with Dr.Explain