I know how to get the geometry (x,y) into attribute fields with the calculator, but I can't figure out how to update the geometry from values contained in attributes.

I am trying Field Calculator > Update existing field > , but I can't find how to assign my "x" and "y" fields to the actual feature geometry.

I don't want to manually drag each point with the vertex editor, or type in each coordinate. I have to update many points.


Assuming you have chosen <geometry> field in the Update existing field drop down list, the expression you need would be:

geom_from_wkt('POINT('||"x"||' '||"y"||')')
  • Awesome - I would never have figured out the || by myself... Thank you for the quick response. – benny the spaceman Jun 8 '18 at 4:28
  • Great! Thanks @Benoit_W :) You would have found out that sooner or later. – Kazuhito Jun 8 '18 at 12:48
  • The syntax is actually quite misleading. Here is the correct one with example coordinates: geom_from_wkt('POINT('||'31.797788'||' '||'30.729471'||')') Notice the single quotes. Using double quotes in QGIS 2/3 will cause an error as it mistakens the x and y values as field names. – 15Step Jan 24 '19 at 12:50
  • @15Step This syntax is reading values from "x" and "y" fields, such field names were set by OP. – Kazuhito Jan 24 '19 at 13:17
  • I misunderstood the question, sorry about that! I think the comment could still be useful for updating numerical coordinates in the <geometry> field. – 15Step Jan 24 '19 at 14:24

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.