I've written an expression to update node layers coordinates to coordinate values from a survey file with the following expression:

geom_from_wkt('POINT('||$x||' '||$y||' '||$z||')')

(replacing $x, $y and $z with the field names of the northing, easting and elevation values) This works great for moving the nodes to the proper coordinates.

Now I'm trying to use the same logic to update the start and end points of a line layer but I can't seem to get the proper syntax, what I was expecting to work is:

geom_from_wkt('start_point('||$x||' '||$y||')')

geom_from_wkt('end_point('||$x||' '||$y||')')

(again, replacing $x and $y with the attribute field names)

I'm not getting any errors, but the geometry is also not updating... I can only assume the expression is not written correctly? or is there a better way to accomplish this task?

  • start_point only works with geometry of lines and geom_from_wkt only with wkt-geometry. Shouldnt it rather be something like start_point(geom_from_wkt('Linestring('||"x1"||' '||"y1"||','||"x2"||' '||"y2"||')'))? Still not really sure what you are trying to do...
    – MrXsquared
    Commented Jan 2, 2019 at 18:40
  • Where are you inputting your expression?
    – csk
    Commented Jan 2, 2019 at 18:56
  • 1
    I'm working on a pipe network, it's made of a line vector layer for pipes and a node vector layer for manholes, I've updated the node layer coordinates (as mentioned above) with the actual surveyed values from the field work so that the nodes are in the correct locations, no I want to be able to update the start and end coordinates of the lines so that they match the manhole coordinates. My line records have upstream/downstream manholes identified and I'm joining the tables so that I have the upstream (start) coordinates and downstream (end) coordinates available in the line layer.
    – CEL-ma
    Commented Jan 2, 2019 at 19:03
  • 1
    I'm inputting my expression in the field calculator, I've selected 'update existing field' and choosen 'geometry'.
    – CEL-ma
    Commented Jan 2, 2019 at 19:03

1 Answer 1


To update your line geometry, an expression like geom_from_wkt('Linestring('||"x1"||' '||"y1"||','||"x2"||' '||"y2"||')') should do it. In case you only want a point layer of start and end points to be updated use start_point(geom_from_wkt('Linestring('||"x1"||' '||"y1"||','||"x2"||' '||"y2"||')')) respecitvely end_point().

To get the attributes / geometry from your node layer to your line layer you need a matching field (id or similar) and use something like x(geometry(get_feature('yournodelayername','matchingfield_of_nodelayer',attribute($currentfeature,'matchingfield_of_linelayer')))))

  • geom_from_wkt('Linestring('||"x1"||' '||"y1"||','||"x2"||' '||"y2"||')') was exactly what I was looking for. I haven't worked with geom_from_wkt much, so I didn't quite understand the syntax - makes sense now though. Thanks for the great answer
    – CEL-ma
    Commented Jan 2, 2019 at 19:24

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.