# Calculating average slope along line using ArcGIS Desktop?

I have a slope layer and I want to calculate the average slope along a line. This line isn't necessarily straight (e.g its a route, I would like to be able to input geographic coordinates along that line and have a script that outputs the average slope). Is this possible?

A simple approach that you could automate in ArcMap using Python would be to break your line into points at a chosen interval or even just at the vertices. Then extract values to points from the raster to get the longitudinal profile (make sure to select the interpolation option). Then simply calculate the average value of those points.

As @whuber mentioned there is an accuracy trade-off with simplicity, but if you're looking for a simple solution that you could script quickly the above should help.

• (+1) Using an interval of the same magnitude as the cellsize (or slightly smaller) works. Using just the vertices does not work in general, because long spans between vertices will smooth out the variations and always underestimate mean slopes, sometimes by quite a lot. It is important to interpolate with 'extract values to points'; do not accept the default of using the nearest cell centers (that, too, would tend to mis-estimate slopes). Note that different averages will be obtained depending on how slopes are measured (angles or percent)! – whuber Oct 13 '11 at 18:25
• Good catch - as @whuber said, vertices will very likely skew the data. An interval approach would be best and always interpolate. I've update my answer the address this. – Radar Oct 13 '11 at 18:37

If the slope layer only gives the slope value, it is not possible. To calculate the average slope value along the line you also need the slope planar orientation. The whole slope vector is necessary. Keep in mind slope computation usually depends a lot on the input DEM resolution.

• its a slope layer calculated from a DEM. – Nevu Oct 12 '11 at 14:28
• @Kixx In that case there are several ways you can do it, either directly by taking a profile from the DEM or indirectly by computing an aspect grid (the "slope planar orientation"). The question really comes down to how you want to do the calculation: it won't be straightforward and the appropriate solution depends on your skills and accuracy requirements. – whuber Oct 12 '11 at 17:15

If you have a 3D Analyst extension, you could use 'Add Surface Information' tool. With DEM as the input, this tool can be used to add average slope (in percentage) to your line feature. 