I have a line overlaying a raster containing slope values. I would like to use the line to extract the slope values, and return to its attribute table an attribute containing percentage of slopes below 50 percent, and an attribute containing percentage of slopes above 50 percent along the total length. So far I have been able to extract the pixels coinciding with the line using "Extract by Mask". I am however stuck and not sure what to do with this resulting layer.

  • I think you would be better to do it the other way around.. classify your raster to less than/greater than 50%, convert your classified raster to polygon and intersect/identity with the polyline. There isn't really a tool to get the cells 'under a line' but you could buffer the line and extract within a few metres of it. Commented Dec 18, 2015 at 5:40
  • gis.stackexchange.com/questions/75404/… could be worth mentioning in your question, if only to describe the difference between its answer and what you are looking for.
    – PolyGeo
    Commented Dec 18, 2015 at 5:45

1 Answer 1


1) reclassify your slope raster as 0 (<=50%) or 1 (>50): Con("slope" > 50, 1,0)

2) convert your line to raster based on line ID

3) use zonal stat as a table : the mean value will be the proportion above 50% (1-mean will be the proportion below 50%, no need for 2 attributes)

Note that this will yield the proportion of maximum slope of the terrain that the line is crossing, not the proportion of the actual slope of the lines.

  • This works so i will accept the answer. But just a side comment, step 2 is not necessary. Zonal Stat as Table accepts a feature class layer as a zone. But thank you very much for the nifty solution.
    – user32882
    Commented Dec 21, 2015 at 2:50
  • What if I have three ranges of values (e.g proportion below 20%, proportion between 20 and 70 % and proportion above 70 percent) would there be a more elegant way to extrapolate this method without having to do it twice, once for each two ranges?
    – user32882
    Commented Dec 21, 2015 at 3:19
  • with more than two classes, you can use tabulate area instead of zonal stat.
    – radouxju
    Commented Dec 21, 2015 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.