# How to compute average slope and area-weighted average slope?

I am learning GIS for use in hydrologic analysis. Related to computation of overland flow there are two types of slope that I would like to be able to obtain from GIS. The first is average slope for a given polygon area. The second for the same polygon area is an AREA-Weighted average slope. Presumably one would need to divide the polygon into subareas based on a slope-range (say 0-2%, 2%-4%, 4% -10%, etc) then compute a weighted average.

Is there a plugin that will provide this information, . . . or am I at the point where I need to learn how to write a python script?

• Tried the Zonal Statistics Plugin yet? That should solve the first part. To get area weighted I would think you could just reclassify your raster to your desired ranges, then run your zonal stats on that (well, may need to polygonize each class first). Don't know if there is a plugin out there that would do it all for you, but a script or model would be needed for the steps and shouldn't be too hard. Commented Feb 22, 2015 at 20:06
• Thanks, that's what I needed to know. I will give it a shot and try figure out what the correct steps should be. Commented Feb 24, 2015 at 1:27

## 1 Answer

The very first thing you need is a slope raster, which is created from a DEM - see 8.3.3 here.

To solve the first part of your problem, the average slope, you need a zonal statistics tool. This provides statistics of one raster's cell values based on areas defined by polygons or cells of constant value in another raster. There is a QGIS Zonal Statistics Plugin.

The area weighted average slope is a bit more of a challenge. For that you first need to classify your slope raster into the desired ranges. You could use broader ranges like your question, or more specific (rounded to nearest percent) if you wanted a more fine grained average slope. Then you need to calculate the area of each range within each zone. I don't know of an easy way to do this in QGIS (the methods or answers I know of already here apply specifically to Arc) and just off the top of my head it might be best as a separate question. I don't think that zonal stats plugin offers a case option (if it did you could get the sum area of each class per zone with it). Once you had the area of each class though, it'd be simple field calculations to determine class area percentage of zone and then multiply that percentage by class slope value, summing all those values, and dividing by the number of values to get the ultimate area-weighted slope.