I'm trying to figure out how to calculate the lat/long of points using the QGIS field calculator. Is there an easy way to do this? I saw a previous related question, but it deals with a more advanced approach.

In ArcGIS this is similar to the Calculate Geometry function; I just can't find where do this in QGIS.

  • how to locate 14'36'51"/121'4"'56" – user80758 Aug 13 '16 at 23:16

Sure can. First, save the layer as WGS84 and import it again. Then in the field calculator you can use $x or $y as a variable to get the x and y.

x and y

NOTE: This was added in 1.7.


You have to reproject the point layer to EPSG:4326 first. Right-click on the layer name in layer list and select "Save as ...". There, you can specify the target CRS to be EPSG:4326.

Load the new reprojected point layer and then run "Export/Add Geometry Columns".

  • 4
    Note that with newer version of QGIS (accessible via OSGeo4W installer) you don't even need to Export a layer to a new CRS. You only need to change CRS of the map canvas to whatever is you choice for output units and CRS and check "Calculate using Project CRS" when doing "Export/Add Geometry Columns" and output to the same shapefile. – Maxim Dubinin Mar 31 '12 at 14:40
  • FYI "Export/Add Geometry Columns" can be found in menu > Vector > Geometry Tools > Export / Add Geometry Columns – clhenrick Feb 25 '16 at 18:18

One option could be specifying the layer CRS as WGS 84(no projection). May be you will have to change the project CRS too. Now use "Vector > Geometry Tools > Export/Add Geometry Columns". This should give you Lat/long coordinates.


Extract nodes. This makes it into a point layer. Then open attribute table, field calculate, Geometry-$y/$x

find polygon corner coordinates


The previous best answer can be considered obsolete.

Using the field calculator, you can get x, y coordinates from points layer in any projection and make the conversion to longitude latitude.

You can find the recipe, documented with formulas and an illustrated GIF.


For user like me, after 7+ years, there is a better and simple answer.

HERE > https://stackoverflow.com/a/51164270/9620153


In QGIS 3.8 (June 2019), there is now an algorithm to add the X and Y values. It can reproject coordinates on the fly.

enter image description here

If you still need a Degree Minute or Degree Minute Second format, you need to use first the to_dm or to_dms expression to add these fields into the attribute table.

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.