I think I have read every thread on QGIS profiles in the stack and I cannot find a way to create a profile that can be produced in context on each page of an atlas print. I can create an image for each segment and call the image as per the appropriate atlas page but none of them allow any control of the y-axis label so they all restart at 0. I want the profile on each page to be a continuation of the one that proceeded it. I have a multi page pipeline alignment and I want the appropriate profile for the shown segment to appear on each page. I hope this makes sense.


2 Answers 2


There's the beginnings of a solution, I think, at QGIS: beautiful HTML/Javascript terrain profiles won't show in Atlas print It involves extracting the profile data into a 2D (distance along path) x (elevation) string and then plotting the profile in an html widget using javascript. There seem to be some timing issues the questioner then solves.

It feels like a lot of recreating of the wheel, but it should work!

Editing to add: Have played around with this more in my use case (don't need atlas feature, but need elevation profiles with control over adjustments). The following workflow works for me and should be adaptable for your needs:

  1. Select lines I care about, ensure they are oriented in the right direction. Use Reverse line direction processing algorithm with Edit-in-place to fix as needed.

  2. Add a field DistOffset which is the distance offset of each segment so it's not zero. (I'm sure could automate this, I did this manually by extracting $length of each segment and making DistOffset be the sum of the previous segments' lengths.)

  3. Use Points along Geometry algorithm to create equally spaced points along the line segments. A distance field will be created which is distance along segment from its start point.

  4. Use Drape algorithm to add elevation from DEM as z dimension to the points (assuming original segments were LineStrings, not LineStringZs to begin with)

In my use case, I just used dataplotly to then graph the expression z($geometry) vs "DistOffset"+"distance" over the whole network as a static picture. You'll need to work a bit harder.

If you can wait for it to be finished, North Road's "Print Layouts Charts and Graphs" feature (crowd-funded) should then do it for you, if I understand its planned scope correctly.

If you can't, I think the link above (using js and highcharts) is your current best solution. You'll need to extract the relevant points for each segment to tie it back to your atlas. All the original fields in the segment layer are retained, so you can set up a one-to-many relation of the points with the original segment layer, and then use an expression with relation_aggregate with mode concatenate to create a string of distance and elevation data. (I haven't tested this.)


Dataplotly is the tool in QGIS 3.10+. Works great just takes some fiddling with format.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.