This follows a presentation I gave in 2016 at the QGIS Southwest user group at Hertford University. Of course I was meant to write it up then but with moving jobs I forgot until a fellow user was having trouble with profile outputs so here is the process I use.
There are a number of plugins required for this:
QProf (for creating the profile and output – you could also use the Profile plugin)
Points2One (to create the vector profiles)
I also had a DSM and DTM and the process I explain uses both.
The area for the example is the Humber Bridge (shown above) and the DSM and DTM are open data from the Environment Agency 1m LIDAR.
Load the DSM and DTM. Locate the area for your profile and either draw a line (I used a scratch layer) or use an existing line layer. I digitised a line along the centre of the bridge from one side to the other being careful not to stray either side – the white line in the figure below. The figure also shows the DSM layer with the DTM below it.
I don’t intend to go through the use of the QProf tool I figure you can do that yourselves but it is easy to use and has many options. Below is an image of the profiles from the line layer. You can see the bridge deck and piers quite clearly also the banks and water surface:
QProf allows you to export in many formats, I choose csv and I create a separate csv for both the DTM and DSM.
Once you have saved the csv files, open then up in a spreadsheet – I find it easier to do this than a text editor my preference being Libra Office Calc. You should see 7 columns of figures: the ID, X and Y (I’m doing this in BNG (EPSG:27700) I have not tried it in any other), cds2d (this will become our ‘row order’), z, cds3d and dirslop. Now here is the bit that you have to get right: we don’t want to use the ID, X & Y as this will put out profile over the map – we want to have a two dimensional view but in the map window so delete these.
We use the ‘cds2d’ values as our row order – change the column name to ‘ID’.
The ‘z’ column becomes our ‘Y’ coordinates – change the column name to ‘Y’.
The ‘cds3d’ column becomes our ‘X’ coordinates – change the column name to ‘X’.
Save the csv and open it in QGIS – you won’t see it in the window because we have transformed the coordinates so that it is in the very lower left corner of the BNG BBox.
Select the layer and zoom to it, you should see a series of points. Do the same process for both the DTM profile and DSM profile.
Creating the profile lines.
When you are zoomed to the point layer you can transform them into lines or polygons using the Points2One plugin which creates shp files, this process is self-explanatory. Keep the point files as the height data is not retained in the shp files and you can play about with the points to make them vertical lines based on the height value – have a go and see what you can do.
Below is the finished profiles for the Humber Bridge and water/banks, obviously I’ve coloured the water line to look a little more authentic.