I need to store the z value for hiking paths. I have the GPS coordinates (points) and the tracks (polylines). I know I can store elevation data easily with the points but are there any ways of storing elevation data with polylines?

I would like to avoid having to make a huge table of a gigantic collection of points so I would prefer to only store the tracks. I am using QGIS.


1 Answer 1


If you add the GPS data to QGIS as a GPX file, it will load as a set of points with Z (elevation) values (PointZ).

Using the Points to Path tool from Processing (quickest access using ctrl-K or cmd-K to search), select the added layer: enter image description here The only challenge is getting the 'order' field correct (and it's not optional); many GPS units don't save a date/time to the 'time' field in the GPX, sometimes saving it in the 'cmt' or 'desc' fields, which are often overwritten with descriptive text. You may have to make a new version of the layer (select-all then Edit | Paste Features As | Temporary scratch layer) and add an 'order' column and add integer values to set the order you want to use.

The output will be a LineStringZ geometry with X, Y, Z where the Z value comes from the elevation at that point.

  • I have done this, but where does the polyline store the elevation data? is it embedded in the geometry?
    – Hailey
    Jul 23, 2020 at 15:24
  • See the updated answer! It's embedded. You might want to look into a python script like gpx2spatialite for storing track (line) and trackpoint (point) data from GPX files in a single spatialite database if you want to develop a better system for recording lots of GPS data.
    – Simbamangu
    Jul 24, 2020 at 13:01
  • great advice! I am however using a SQL database and PostGIS. Do you know of any way to store GPS data using a similar method?
    – Hailey
    Jul 27, 2020 at 9:26
  • There is. If it doesn't apply, ask a new question perhaps!
    – Simbamangu
    Jul 30, 2020 at 16:50

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.