1

I am using QGIS 2.18.6 . I have created two line layers. First layer "testroad" with long line (road). Second with short lines along,near road. I would like to know distance of first and last point of every line in second layer along line of first layer without creating another point layer. I've tried using expression in field calculator:

line_locate_point(geometry:=geometry(get_feature('testroad', 'id', '1')), point:=end_point($geometry))

But it always returns 0. I am new to QGIS and don't understand what is wrong with:

point:=end_point( $geometry)

rest of expression works.

  • 1
    Your expression works well here (my version is 2.18.27, maybe you need to upgrade it?). Make sure that both layers have the same CRS assigned. – Gabriel De Luca Jan 14 at 17:17
1

Gabriel De Luca thank you for your response.

Both layers have same CRS assigned.

I did install QGIS 3.4 and import test layers. Same issue occured. I've created secondary test layers and it turned out exprssion works both in QGIS 3.4 and in 2.18.6.

I think one of layers i've created just to test expression must be somehow corrupted...

  • You are welcome. I'm glad you solved it. – Gabriel De Luca Jan 15 at 11:41

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.