# Average slope (in °) for each area

I have nationwide areas I want to get the average slope in ° in a south-north line for each area. I found something about zonal statistics in QGIS and DEM (enter link description here) but returns just the average elevation.

How to get the slope?

• So do you have a DEM as well? We need a bit more detail before we can answer. Sep 1, 2022 at 15:14
• I will use the copernicus DEMs and clip them for germany. land.copernicus.eu/imagery-in-situ/eu-dem/… Sep 1, 2022 at 15:16
• And please can you elaborate what you mean by "in a south-north line" for each area? Sep 1, 2022 at 15:19
• Please note that slope and aspect are angles so the arithmetic mean is incorrect. Here is a post where I show how to derive mean angle. Unfortunately, you cannot pass a custom function to zonal in ArcPro or QGIS so, you may want to think about Python or R. gis.stackexchange.com/questions/428097/… Sep 1, 2022 at 17:25
• That's an interesting point Jeffrey but my understanding is that you can use an arithmetic mean or median on slope degrees as it ranges from 0 to 90 degrees meaning you have no negative vector? Happy to be told otherwise. Sep 2, 2022 at 7:45

Calculating Slope

To calculate the slope of a DEM in QGIS you can use the "Slope" tool under the "Raster terrain analysis" section of the toolbox. I recommend using the default Z factor of 1 for your purpose. I won't go into detail and I haven't looked at the DEM you are proposing but you may choose to smooth/fill voids in the DEM. Calculating average slope for a given area

Assuming your nationwide areas are projected to the same projection as your DEM and are vector layers you can use the "Zonal Statistics" tool under "Raster Analysis" in the the toolbox. Here your input for "Input Layer" will be your vector nationwide areas. Your "Raster layer" will be your newly created slope layer. Your "Raster band" should default to band 1. Add a prefix if you want for the output statistic fields. Select either mean or median under "Statistics to calculate" and hey presto.  • Slope is an angle so, the arithmetic mean or median, via zonal statistics, is incorrect in representing average slope or aspect. You can sort of get around this with slope by deriving it as percent rather then degrees but with aspect, you are forced to apply the correct equation. Sep 1, 2022 at 17:19
• That's an interesting point Jeffrey but my understanding is that you can use an arithmetic mean or median on slope degrees as it ranges from 0 to 90 degrees meaning you have no negative vector? Happy to be told otherwise. Sep 1, 2022 at 19:58
• @JeffreyEvans I don't unterstand why I the angle is a problem and the mean /median are wrong. as stated above the angle ranges from 0 to 90...or in other words what am I missing? Sep 3, 2022 at 21:41
• ...and with percent this approach works? Sep 3, 2022 at 22:46