Tutorial: Create a longitudinal river profile
4. Sample elevation along the river
In this section we're going to sample elevation from the DEM at fixed distances along the river. In that way we can create a table from which we can draw the longitudinal river profile.
1. Open the Processing Toolbox: in the main menu go to Processing | Toolbox.
2. Choose Vector Geometry | Points along geometry.
3. In the Point Along Geometry dialogue choose the Rur_river_dissolved as Input layer. Change the Distance to 1 kilometers and save the Intepolated points to the data_longitudinal_profile.gpkg GeoPackage with the layer name Sample1km.
4. Click Run. Close the dialogue when the processing is done.
The result should look like the figure below.
Now we need to sample the elevation at each of these points.
5. In the Processing Toolbox go to Raster analysis | Sample raster values.
6. In the Sample Raster Values dialogue choose Sample1km as the Input Point Layer and DEM as the Raster Layer to sample. Expand the Advanced Parameters and type DEM_ for the Output column prefix. Save the Sampled Points the data_longitudinal_profile.gpkg GeoPackage with the layer name Sample1kmZ.
7. Click Run. Close the dialogue after processing.
8. Inspect the attribute table of the result.
Now we have an attribute table with a distance field giving the distance along the river and a DEM_1 field with the elevation.
In the next section we're going to make the profile with the Data Plotly plugin.