Part III: Calculate Spatial Statistics of Forest Patches

In Part III, we will use two Spatial Analyst tools to bring together the raster layers we created in Part I (habitat quality) and Part II (forest patches). Zonal Geometry calculates several geometry measures, such as area and thickness, for zones in a raster. We will use it to generate a table of statistics about the size and shape of each forest patch. We will also use the Zonal Histogram Tool to tabulate the number of cells of each habitat type within each forest patch and management unit.

  1. Calculate the Geometry of Each Forest Patch

    1. Go to Toolboxes > Spatial Analyst Tools > Zonal > Zonal Geometry as Table. Use the settings shown below. Name the table "PatchGeometry.dbf" and save it in your Lesson7 folder. Make sure to include the .dbf file extension. 

      Screen shot of Settings: Input raster: ForestPatches.tif, Zone field: ForestID, Output table: PatchGeometry.dbf, Processing cell size: 100
      Square yellow sign with hand and the word stop

      Make sure you have the correct answer before moving on to the next step.

      The "PatchGeometry" table should have the following information. If your data does not match this, go back and redo the previous step.

      screenshot patch geometry data to compare. See accessible table below
      Accessible PatchGeometry Data Set
      OIDValueAreaPerimeterThicknessXcentroidycentroidMajoraxisminoraxisorientation
      016420100003506006343.9168810035920624878.68214.2181.9311
      125800003800212.11696040379519631.205292.48884.2196
      2312286700009070006250.3175635033577536173.210811.8134.675
      3419000024001501698610378516270.871223.275140.531
      453000002800170.71699130378353401.382237.911110.363
      561000040050169956037801656.41956.41990
      6713000016001501700800377131219.193188.785166.224
      781000040050169836037721656.41956.41990

       

      lightbulb icon

      Which field in the "PatchGeometry" table is the equivalent to the "ForestID" field? What are the units of the fields "AREA," "PERIMETER," and "THICKNESS"? What do the values in the fields "XCENTROID," "YCENTROID," "MAJORAXIS," "MINORAXIS", and "ORIENTATION" mean?
       

    2. Add a new short integer field named "ForestID" and populate it with the values in the "VALUE" field using the field calculator. This step will make it easier to compare the Patch Geometry table with other outputs later in the lesson.
    3. Add three new float fields named “TotAreaSQM,” “PerimeterM", and “ThicknessM.” Calculate them to equal the values in “AREA,” "PERIMETER,” and "THICKNESS,” respectively. This will help us remember the units of the calculations later on.
  2. Calculate Habitat Statistics by Forest Patch

    The Zonal Histogram tool will create a summary table that contains one row for each unique value in the "Value raster" and one column for each unique value in the "Zone dataset." The tool will calculate the total number of cells for each combination of a unique row and column. The tool can also create a graph based on the output table, which we are going to skip.

    1. Open the Zonal Histogram tool (Toolboxes > Spatial Analyst Tools > Zonal > Zonal Histogram). Use the settings below and click "Run." Make sure to add the .dbf extension.

      Settings: Input raster: HabitatGrid, Zone field: VALUE, Input value raster: ForestPatches.tif Output table Habitat_by_Patch.dbf
    2. Open the "Habitat_by_Patch" table. The "LABEL" field contains values equivalent to the "Rowid" field within "ForestPatches." The "VALUE_2" field contains the number of cells of edge habitat for each forest patch. The "VALUE_3" field contains the number of cells of interior habitat for each forest patch (Remember that we used codes of 1, 2, and 3 to represent the different habitat types throughout the lesson).
    3. These field names are not very intuitive, and we may forget what they mean later on. Let’s add a few new meaningful fields to address this potential problem.
    4. Add a new short integer field called "ForestID" to the "Habitat_by_Patch" table. Use the calculate field tool to populate it with the values in the “LABEL” field.
    5. Add two new float fields named "Edge_SQM" and "Int_SQM." Calculate the fields as shown below (# of cells * cell length * cell width):


      screensnot edge_sqm= !VALUE_2! * 100 * 100screenshot int_sqm=  !VALUE_3! * 100 * 100
    6. Remember from Lesson 4 that it is a lot easier to compare multiple area values if you use percent of the total area instead of actual area values. Add two new short integer fields named "PctTotEdge" and "PctTotInt." Calculate the fields as shown below. Notice the 100 in the equation is used to create a percent value and is not related to the 100 value we used in step e, which corresponds to the length and width of the raster cells.

      screenshot PctTotEdge= !Edge_SQM! / (!Edge_SQM! + !Int_SQM!) * 100screenshot PctTotInt = !INT_SQM! / (!Edge_SQM! + !Int_SQM!) * 100
      Square yellow sign with hand and the word stop

      Make sure you have the correct answer before moving on to the next step.

      The "Habitat_by_Patch" table should have the following information. If your data does not match this, go back and redo the previous step.

      screenshot habitat by patch data. See accessible table below
      Accessible Habitat_by_Patch Data Set
      oidLabelValue_2Value_3FORESTIDEDge_sqmint_sqMPCTtotedgepcttotint
      01222074199412220700004199400003565
      12580258000001000
      23740954877237409500004877200006040
      34190419000001000
      45300530000001000

       

  3. Calculate Habitat Statistics by Management Unit

    1. Use the Zonal Histogram Tool to determine the amount of each habitat type by management unit as shown in the example below: Don’t forget the file extension.

      Settings: Input raster: Management_Units, Zone field: Use, Input value raster: HabitatGrid Output table Habitat_by_Mu.dbf

       

      lightbulb icon

      What do numbers in the "LABEL" field of the "Habitat_by_MU" mean? Which management unit "use" has the most roads?



       

    2. Add a new text field (length 25) named “Habitat.” Use the field calculator and the information below to update the new field.
      • 1 - Low-Quality Habitat (Road Clearings)
      • 2 - Medium Quality Habitat (Forest, Edge Habitat)
      • 3 - High-Quality Habitat (Forest, Interior Habitat)
    3. Add two new float fields named “LogSQM” and “ConsSQM.” Add two new short integer fields named “PctTotLog” and “PctTotCons.” Calculate them using the technique we used in Step 2 e and f.

      Square yellow sign with hand and the word stop

      Make sure you have the correct answer before moving on to the next step.

      The "Habitat_by_MU" table should have the following values. If your data does not match this, go back and redo the previous step.

      screenshot Habitat by MU data. See accessible data table below
      Accessible Habitat_by_MU dataset
      OIDLabelloggingcoservationhabitatlogSqmconssqmpcttotlogpcttotcons
      01353221428Low Quality Habitat35322000014280000964
      1263597844954Medium Quality Habitat6359780000449540000937
      23302425167611High Quality Habitat302425000016761100006436

       

    4. Join Forest Patches to Geometry Table

      1. Since we no longer need the forest patches to be in raster format, let’s convert them to a shapefile so they are easier to use.
      2. Convert the "ForestPatches.tif" grid to a polygon shapefile using the settings below: Toolboxes > Conversion Tools > From Raster > Raster to Polygon.

        Settings: Input raster: ForestPatches.tif, Field: ForestID, Output polygon features: ForestPatchPoly.shp. Select simplify polygons
      3. Add a new short integer field named "FORESTID" and populate it with the values in the "GRIDCODE" field.

        Square yellow sign with hand and the word stop

        Make sure you have the correct answer before moving on to the next step.

        The "forestpatchpoly" shapefile should have the following information. If your data does not match this, go back and redo the previous step. Note that this table has been sorted based on "gridcode".

        screenshot forestpatchpoly data.  See accessible data table below
        Accessible ForestPatchPoly Data Set
        FidShape*IdgridcodeForestID
        36Polygon3711
        0Polygon122
        61Polygon6233
        1Polygon244
        2Polygon355

         

      4. Join the "PatchGeometry" and "Habitat_by_Patch" tables to the "ForestPatchPoly" shapefile using the link fields shown below.

        Settings. Input table: ForestPatchPoly. Input Join Field: ForestID, Join Table: PatchGeometry, Join Table Field: ForestIDSettings. Input table: ForestPatchPoly. Input Join Field: Habitat_by_Patch, Join Table: PatchGeometry, Join Table Field: ForestID
         
      5. Open the attribute table to make sure the joins worked properly. Notice how it is hard to view the attributes we are most interested in since there are so many fields.
      6. On the ribbon, go to the Table > Field >Fields screenshot Fields icon, and uncheck the "Visible" box on the top left side. Add the checkboxes back to the eight fields listed below and click "Save."
        • ForestID
        • TotAreaSQM
        • PerimeterM
        • ThicknessM
        • Edge_SQM
        • Int_SQM
        • PctTotEdge
        • PctTotInt
      7. Close and then re-open the ForestPatchPoly attribute table, if necessary. Notice how it is much easier to interpret the results now.
      8. To make the joins and table design permanent, export the "ForestPatchPoly" to a new shapefile in your Lesson 7 folder named “Final_Forest_Patches.shp.”
      9. Examine the attribute table.
    5. Calculate the Edge to Area Ratio of each Forest Patch

      1. Calculate the edge to area ratio for each patch. Add a new float field named "EdgetoArea." Calculate it as shown below. Note: we are going to multiply the result by "100" to make the values easier to compare.

        screenshot. EdgetoArea= !PerimeterM! / !TotAreaSQM! * 100
        lightbulb icon

        Why is there such a large range of values for the edge to area ratio results?

        How would the results of the analysis change if we used a larger or smaller cell size?

        Square yellow sign with hand and the word stop

        Make sure you have the correct answer before moving on to the next step.

        The "Final_Forest_Patches" attribute table should have the following information. If your data does not match this, go back and redo the previous step.

        screenshot final forest patches  See accessible data table below
        Accessible Final_Forest_Patches Dataset
        FIDShape*Forest IDTotareasqmperimetermthichnessmedge_sqmint_sqmpcttotedgepcttotintedgetoarea
        36Polygon16420100003506006343.922207000041994000035650.05461
        0Polygon25800003800212.1580000010000.655172
        61Polygon31228670000907006250.374095000048772000060400.07382
        1Polygon41900002400150190000010001.26316
        2Polygon53000002800170.7300000010000.933333
        3Polygon6100004005010000010004
        5Polygon71300001600150130000010001.23077

         

        information icon

        Notice how the default outputs from many of the Spatial Analyst tools are not very easy to understand. It’s worth the time to create more intuitive fields, units, and names while you are doing the analysis. That way you can easily interpret your results later on and share them with others in a meaningful format.