Thursday, 15 March 2018

arcpy - 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?



Answer



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.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...