Geographic Information Systems Asked by Charlene on October 13, 2020
I am using QGIS 3.10 for windows, and I am trying to create a shapefile such that I can load it into QField and take points in the field, and have those points auto generate their coordinates. I have tried using the $x
and $y
expressions, but they either are not working or not saving, because every time I try to create a point the Easting and Northing fields are still NULL and when I go back into the Field Calculator the expression is blank. Below are my attribute table and attributes form showing the expression:
Try to insert this $x and $y expression in "Default value" field and check "Apply default value on update" box.
Answered by Konrad on October 13, 2020
If you have you data in Geopackage, you can use triggers for that.
Same examples:
-- Trigger to calculate the coordinate X/Y of a newly added point geometry
CREATE TRIGGER insert_x AFTER INSERT ON points BEGIN UPDATE points SET x = st_x(geometry); END;
-- Trigger to calculate the coordinate X/Y of an edited point geometry
CREATE TRIGGER update_x AFTER UPDATE OF geometry ON points BEGIN UPDATE points SET x = st_x(geometry); END;
Answered by Nelson Silva on October 13, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP