QGIS — Adding Latitude and Longitude to your attribute table

QGIS Samath

This is a quick guide on how to add the coordinates of particular points into your shapefile attributes table.

This may help if you are creating some CSV data of the map for developers.

  1. For QGIS adding points your SHP file geometry type should be in point format.
  2. Select the “Add Point” Tool. (Figure 1)
  3. Place the pointer where you want to appear. (Figure 2)
  4. Open the Attribute Table. (Figure 3)
Figure 1
QGIS Samath
Figure 2
QGIS Samath
Figure 3

Add the latitude & longitude coordinates

Select the “Field Calculator” button to add the coordinate field.

Select the option “Create a new field” and add your label name under “Output field name”. (Figure 4)

Latitude for the Y value

Longitude for the X value

2) For “Output Field Type” select “Decimal Number(real)” from the drop-down. (Figure 4)

3) For “precision” value, add 8 for perfect accurate coordinate. (Figure 4)

Figure 4

4) To generate the value, from the function list select the Geometry group or search for “Geometry” and double click on “ $y” if your attribute is Latitude. (Figure 5)

Figure 5

The same way “Create a new field” for Longitude and from the function list select “$x” under the geometry group for Longitude coordinate.

After running the function you can see the attribute table is updated with actual coordinates. (Figure 6)

Figure 6

By any chance, if you change the position of the point after you update the attribute tables. The coordinates won't be updated automatically. You need to open the Field calculator and need to select the “existing field” and run the function.

Make sure you have unchecked the “only update selected” on the left side if you want to update all the fields.

Figure 7

Thanks for the read….