I am trying to cut multiple terrain profiles and export them to CSVs (individual or combined).
I have a shapefile of the profile lines, and a DEM to cut the profiles from.
I can do this manually multiple ways (i.e. Profile Tool) and either copy the profile data or export it by clicking some buttons...but I am wondering if there is a way to automate this for MANY profiles.
I.e., run a script/plugin that cuts profiles at every line in the shapefile and exports them to a CSV file.
Sample raster values or
Add Raster Values to Points tool to extract raster values:
Extract verticestool if the vertices are frequent enough, or
Points along geometrytool if you want more frequent/evenly spaced sampling points
Sample raster valuesor
Add Raster Values to Pointstool to add elevation values to the point layer created in step 2.
extract verticestool in step 2, the distance between points should be controlled by the "distance" attribute.
points along geometrytool in step 2, plot the points equally spaced.
If the profile lines are all in the same layer, you'll only need to run through this process once.
If you're doing this multiple times, consider putting this process into a Graphical Processing model.
Here's another method using the
Drape (set Z-value from raster)tool to add elevation to the line vertices.
Export the profile lines (now with Z values) to CSV. Under Layer Options, choose Geometry
Plot a separate profile graph for each unique "Line_ID" value. Use the "distance" attribute to control the spacing of the points on the graph.