How can I get an elevation profile for a band of terrain?
The highest elevation within 10 km (on each side of the defined line) should be taken into account.
I hope my question is clear. Thank you very much in advance.
Following on from the comments, here's a version that works with perpendicular line segments. Please use with caution as I haven't tested it thoroughly!
This method is much more clunky than @whuber's answer - partly because I'm not a very good programmer, and partly because the vector processing is a bit of a faff. I hope it'll at least get you started if perpendicular line segments are what you need.
The image below shows an example of the output from the script. You feed in a shapefile representing your centre-line, and specify the length of the perpendicular lines and their spacing. The output is a new shapefile containing the red lines in this image, each of which has an associated attribute specifying its distance from the start of the profile.
As @whuber has said in the comments, once you've got to this stage the rest is fairly easy. The image below shows another example with the output added to ArcMap.
Use the Feature to Raster tool to convert the perpendicular lines into a categorical raster. Set the raster
Finally, convert this raster to an integer grid (using the Int tool or the raster calculator), and use it as the input zones for the Zonal Statistics as Table tool. You should end up with an output table like this:
NB: One obvious problem with this method is that, if your original line is very wiggly, some of the transect lines may overlap. The zonal statistics tools in ArcGIS cannot deal with overlapping zones, so when this happens one of your transect lines will take precedence over the other. This may or may not be a problem for what you're doing.
The highest elevation within 10 km is the neighborhood maximum value computed with a circular 10 km radius, so just extract a profile of this neighborhood maximum grid along the trajectory.
Here is a hillshaded DEM with a trajectory (black line running from bottom to top):
This image is approximately 17 by 10 kilometers. I chose a radius of just 1 km rather than 10 km to illustrate the method. Its 1 km buffer is shown outlined in yellow.
The neighborhood maximum of a DEM will always look a little strange, because it will tend to jump in value at points where one maximum (a hill top, perhaps) falls just beyond 10 km and another maximum at a different elevation comes just within 10 km. In particular, hilltops that dominate their surroundings will contribute perfect circles of values centered at the point of local maximum elevation:
Darker is higher on this map.
Here is a plot of the profiles of the original DEM (blue) and the neighborhood maximum (Red):
It was computed by dividing the trajectory into regularly spaced points at 0.1 km apart (starting at the southern tip), extracting the elevations at those points, and making a joined scatterplot of the resulting triples (distance from beginning, elevation, maximum elevation). The point spacing of 0.1 km was chosen to be substantially smaller than the buffer radius but large enough to make the computation go quickly (it was instantaneous).
I had the same problem and tried James S' solution, but couldn't get the GDAL to work with Fiona.
Then I discovered the SAGA algorithm "Cross Profiles" in QGIS 2.4, and got exactly the result I wanted and that I presume you are looking for too (see below).