5

I have a point layer that I am adding to and am working in British National Grid. Two of the columns are Easting and Northing. When I add a new point I want these two columns to be filled out automatically with the Easting and Northing values.

Does anyone know how to achieve this using QGIS?

1
  • 1
    You can use the AutoFields plugin for that. You need to choose your layer, your existing fields, and define the expressions $x and $y respectively. The plugin stores the automatic values into your data. Have a look at the docs. Aug 19 '16 at 22:44
3

Alternatively, you can use the Vector -> Geometry Tools > Add Geometry Columns, and execute both X/Lon, Y/Lat calculations at once

enter image description here

2
  • +1, can't believe I forgot about that function as I used it only yesterday!
    – Joseph
    Jan 27 '15 at 14:58
  • 1
    Unfortunately, this method mises the automatically part of the question. You get the coords for all existing points, but new points created after that will remain empty. The virtual fields from the other answer update themselves with every new point you create.
    – AndreJ
    Jan 27 '15 at 16:22
3

Without any scripting, the easiest is probably by creating virtual fields (available from QGIS 2.6). You will need to create a project file (.prj) for this via the toolbar Project > Save As...

Then for your point layer, open your Attribute Table > Field Calculator (see image for options selected and expression):

Attribute table

Repeat for a "Northing" column. These virtual fields will update automatically everytime the project file is loaded. So, when you add points, save the project and reload.

Hope this helps!

4
  • 1
    Keep an eye on the field type: it should be decimal (not the default integer), and for degrees with a good precision.
    – AndreJ
    Jan 27 '15 at 16:24
  • Thanks for highlighting that very important point @AndreJ
    – Joseph
    Jan 27 '15 at 16:31
  • 1
    The virtual fields update on adding a new point. No need for save of the layer or project to see the values in the attribute table.
    – AndreJ
    Jan 27 '15 at 16:42
  • Huh, should have tested that. Thanks again @AndreJ
    – Joseph
    Jan 29 '15 at 10:32

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.