I have a vector line, but it has no z-dimension.

I have some points along the line, which have the elevation included.

enter image description here

Can I add the elevation from the points to the line at that specific point?

QGIS 3.4.4

  • Have you tried join attributes by location? If so, what went wrong?
    – Erik
    Feb 8, 2019 at 13:03
  • Yes - I don't get any of the elevations into my new joined line.
    – Joachim
    Feb 8, 2019 at 13:10
  • 1
    Did you check whether the point are really sitting on top of the line? What settings did you use? Why didn't you include this into your post?
    – Erik
    Feb 8, 2019 at 13:16
  • Do you want to store the elevation data as an attribute? Or do you want to convert your line to a 3-D line and store the elevation as Z coordinates?
    – csk
    Feb 8, 2019 at 18:34

1 Answer 1


Convert your 2-D line to a 3-D line with the Set Z values tool. Define the Z value with this expression, substituting your layer and field names:

geomnearest( 'point layer', 'elevation field')

(Make sure you have the RefFunctions plugin installed, or you won't have access to the geomnearest() function.)

enter image description here

Be sure to save the output as a permanent layer.

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.