Created a global map by adding the OpenStreetMap and WorldMap layers in QGIS. Drew polygons over that, creating what I believe is a polygon layer.

I've also created a layer of the Nodes/Vertices of the Polygon by clicking Vector->Geometry Tools->Extract Vertices (see photo)

  • Would like to extract the latitude and longitude of these polygon points (csv, GeoJSON, or somehow connect to MSQLServer eventually)

I've tried adding calculated fields to the Attribute Tables of the Vertices layer following but am new to GIS and have been unsuccessful.

Example of the Polygons I'm trying to get the latitude/longitude of


Open your attribute table of the layer you want to add this information to and its field calculator. Create a new field with data type double/real and give it a length of 3 and a precision of, lets say, 8. Name it x/lng and y/lat and insert the expression

x(transform($geometry, layer_property(@layer_name, 'crs'), 'EPSG:4326'))

for longitude and

y(transform($geometry, layer_property(@layer_name, 'crs'), 'EPSG:4326'))

for latitude.

This expression will work with every source crs, so you do not need to care about that. In case your layers crs already is EPSG:4326, it would be enough to just enter the expression $x or $y.

  • Hi, is there a way to directly add the latitude and longitude of the vertices in the polygon layer itself ? I have a polyline and want to the do the same. I want the lat lon of the head and the tail node of each line in the polyline layer. – Ganesh Ambi Ramakrishnan May 6 '20 at 0:47

If you need latitude and longitude as csv you may simply right click your vertices layer and choose Export > Save Features as...:

enter image description here

Then in the dialogue chose Comma Separated Value [CSV] in the combo box on top:

enter image description here

Chose a file name and if applies various restrictions for the output (attributes to export, extent,...). Scroll down and under Layer Options select the output format for your coordinates (here I chose 'AS_XY'). Note the tooltip!

enter image description here

The result will be something like (opened in Notepad++):

enter image description here


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.