TransWikia.com

QGIS update feature geometry from attribute fields

Geographic Information Systems Asked by benny the spaceman on August 16, 2021

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.

2 Answers

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"||')')

Correct answer by Kazuhito on August 16, 2021

I modified this a bit to move a selection of points into a spread out line along a vertical axis.

geom_from_wkt('POINT('||$x||' '||((@row_number*100)+$y)||')')

The 100 can be changed to whatever is appropriate for your area and scale. I imagine that this could be further modified to create a grid, but I didn't have time to try.

Answered by hillibilli on August 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP