I have a dataset of gps points with DateTime and id field and I would like to create a line vector so that I can use this vector for interpolation on a raster. My goal is to find the mean of the altitude between a location and the next one. Is it possible in QGIS? I manage to create the trajectories with the Points to path function, but now I don't know how to use this "linestring" file. Can someone help me?

EDIT: The altitude is stored in a different file, a raster. What I would like to achive is to create a line with the gps locations and then use this line to find on my altitude raster the mean of the altitude between two successive locations. My output should be something like this:

x          y        DateTime          id   mean.altitude
716310.48  7343903  12/07/2010 00:00  05   356
718398.12  7341580  12/07/2010 02:00  05   301

where mean.altitude is the mean altitude of the imaginary elements (where the line lies) between the first point and the second one.

  • It sounds like you have answered your own question - use points to path, could you edit your question to make it clearer as to what you are trying to do?
    – Ian Turton
    Jun 30, 2018 at 11:42
  • where do you get those altitudes from? are they stored as attribute to each point? or is that where the 'raster interpolation' comes in? and what would be your desired output for those mean values (saving them to the point file is unlikely)?
    – geozelot
    Jun 30, 2018 at 12:19
  • I added more details in the question. Jun 30, 2018 at 13:53

1 Answer 1


So it is not a simple arithmetic mean of two vertices, but the mean of the altitude along the line segment, right? It can be done in two steps:

  1. Explode lines - breaks your line into segments (QGIS Processing Toolbox | Vector geometry)
  2. Add raster values to features - calculates mean of all cell values along each segment (QGIS Processing Toolbox | SAGA | Vector <-> raster)
  • Correct! I was trying to do as you say, but I got an error from the SAGA algorithm...the Log console says: Unknown option 'INTERPOL' I'm trying to fix this. Jul 2, 2018 at 9:25
  • @SalvatoreValente Sorry, I should have checked your QGIS version in detail. Do you happen to have QGIS 3.0.x? I have only tested with QGIS 3.2 and 2.18.20.
    – Kazuhito
    Jul 2, 2018 at 12:56
  • I have now QGIS 3.2, but I realized that was easier doing this kind of calculations on R. I fixed my problem with it. Thanks anyway! Jul 3, 2018 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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