Calculating Area Weighted Means with ArcGIS

July 19, 2007

Bongghi Hong and Dennis Swaney

This document describes how the area weighted means can be calculated in ArcGIS. Specifically, how gridded data overlaid on a map of multiple watersheds can be used to create maps of (area weighted) average values for each watershed.There must be several different ways of accomplishing the goal, but here we use a freely available ArcGIS extension called Hawth’s Analysis Tools (

The program can be downloaded by clicking on “download > DOWNLOAD HAWTH’S TOOLS (v3.26) FOR ARCGIS 9.x”. Unzip the downloaded file and double-click on “htools_setup” and install the tool. Open the ArcGIS and click on “Tools > Extensions...” and check the “Hawth’s Analysis Tools” checkbox. Next, click on “View > Toolbars > Hawth’s Tools” and the Hawth’s Analysis Tools menu bar will appear:

To calculate the area-weighted means, you need two polygon based maps, one containing the values to be averaged (in the example below, “ann_grid_deposition” containing various N deposition estimates on a grid) and another that works as thezonal polygon(in the example below, “nebasin_deposition” containing watershed boundaries):

After adding these two maps, click on “HawthsTools > Analysis Tools > Polygon In Polygon Analysis” to open the tool. Choose the boundary map as “Zonal polygon layer” and the value map as “Summary polygon layer”. In the summary options, select “Attribute field based summary” and check the variables to be averaged. Make sure that “Area weighted mean” is selected as summary statistics and “Use complete field name” as field naming convention:

Clicking “OK” will run the calculation. The result of the calculation is stored in the zonal map. Open the attribute table of the zonal map and you can find the fields containing weighted means (note that in the below example, the field names are identical to the summary fields selected above):

The calculated weighted means can also be shown as a map:

Map Preparation

To run the Polygon In Polygon Analysis of the Hawth’s Analysis Tools, you should provide a value map (“ann_grid_deposition” in the above example) containing variables to be averaged in each column of the attribute table. Possible difficulties that may arise during the map preparation are:

(1) There may be more than one value map covering the area to be averaged → use ArcToolbox “Merge” tool. (in our example, we had 2 separate maps containing gridded data over the northern and southern regions which together contained all data to be averaged. These maps were merged before performing further calculations).

(2) Columns containing variables to be averaged may be located in different value maps (i.e., stored in different attribute tables) → use ArcToolbox “Union” tool.

(3) The value map and the zonal map may have different projections → use ArcToolbox “Project” tool. Note that the desired projection may be imported from one of the maps if desired using the Project tool.

(4) The values to be averaged may be in “string” format, not in numeric format. Data in string format cannot be analyzed as numbers (ie cannot be averaged). → there may be several different solutions, including manual editing, but this problem can be resolved efficiently while using ArcToolbox “Merge” tool.

Below, we describe a case with all four of theseproblems. There are altogether 10 value maps, five covering the region “huc01” and other five covering the region “huc02”. Each of the five maps contains N deposition variables for the winter, spring, summer, fall, or the yearly sum:

The N deposition variables stored in the attribute tables of these value maps have “string” format. The value maps have “GCS_North_American_1983” projection, whereas the watershed boundary map has “USA_Contiguous_Albers_Equal_Area_Conic_USGS_version” projection. To prepare a single map of N deposition, maps in the region of “huc01” and “huc02” were first merged for each season (i.e., “huc01annual” and “huc02annual”, “huc01winter” and “huc02winter”, etc...) using the ArcToolbox “Merge” tool (click on “Data Management Tools > General > Merge”):

Note that some variables have “text” format. To convert them into numeric format, right-click on the variable name and select “Properties...”. A property window will be opened, and you can change the variable type from “text” to “double”:

Note that the suffix “annual” is added to the variable name, so that we will know that it is referring to annual fluxes after all seasonal maps are combined. When the “huc01” and “huc02” maps were merged for each of the five seasons, these five seasonal maps were combined using the ArcToolbox “Union” tool (click on “Analysis Tools > Overlay > Union”):

After running the Union tool, we have a single map “ann_grid_deposition_unproj” containing all the N deposition values for all five seasons (annual, winter, spring, summer, and fall) covering both “huc01” and “huc02” regions. Still, this map has a different projection from the watershed boundary map. This problem can be resolved by running the ArcToolbox “Project” tool (click on “Data Management Tools > Projections and Transformations > Feature > Project”):

Make sure that the output coordinate system is set to the same projection as that of the watershed boundary map. After running the Project tool, the resulting “ann_grid_deposition” map can be used as the input to the Polygon In Polygon Analysis of the Hawth’s Analysis Tools (see above).

AdditionalTips

(1) Copying and pasting a *MAP LAYER* within ArcMap is different from copying and pasting a *MAP* within ArcCatalog. If you want to make a physical copy of a map (not a map layer,which only contains the information of how the map is presented), perform the action using ArcCatalog. The same applies when renaming a map.

(2) When you perform a map calculation (including using a raster calculator), the following may generate an error:

[map1]+[map2]

whereas the following works fine:

[map1] + [map2]

The difference is in the spaces between operators and variables. To make sure that you don’t have this problem, always click on the operation buttons (e.g., “+”, “-”, “/”, “*”, etc...) provided in the calculator instead of typing them using the keyboard.

(3) The “Define Projection” tool (accessible through “Data Management Tools > Projections and Transformations > Define Projection”) is different from the “Project” tool (accessible through “Data Management Tools > Projections and Transformations > Feature > Project”). The latter is changing from one projection to another. The former is defining the projection of a map without considering the earlier projection.

(4) When using the “Define Projection” tool, it’s a good idea to specify the output coordinate system by importing one from an existing map (click on “Import...”), instead of trying to find the name of the coordinate system by clicking on “Select...”: