I am very new to QGIS, so please bear with me.

I have a ".shp" file, which is contains a set of boundaries for suburbs of Australia. I opened it to QGIS and I would like to export it into a CSV file so that the final file would be like following.


When I select "Layer > Open attribute table" I can see the "postcode" column.

I had a look at a similar question here

Getting list of coordinates for points in layer using QGIS?

Which told me to simply go to "Layer > Save as" and then type "GEOMETRY=AS_XY" or "GEOMETRY=AS_XYZ" in the "Layer" section of the "OGR creation options".

I followed exactly, but the latitude and longitude values are not being returned.

  • related: gis.stackexchange.com/questions/43129/…
    – underdark
    Commented Jan 14, 2014 at 19:52
  • Either these answers are old or you have to know the program to understand what you are saying. I cannot follow any of these answers int eh software. Can someone dumb it down for me on how to create a CSV file with layer data (coordinates)? thanks.
    – user52750
    Commented May 27, 2015 at 13:20
  • 1
    @JnOviedo Please be specific about which step causes problems. The answers here are fine.
    – underdark
    Commented May 27, 2015 at 20:46
  • In this post the issue was resolved by Willy using the MMQGIS suggested by Joe Thompson: gis.stackexchange.com/questions/76321/… best regards
    – user72400
    Commented May 2, 2016 at 14:46
  • Note that if your geometry has somehow become a multipart geometry, GEOMETRY=AS_XY will silently fail. You can can fix this by processing the layer with 'Multipart to singleparts'
    – daviewales
    Commented Aug 11, 2021 at 6:12

5 Answers 5


I see 2 solutions: 1st you could create 2 attributes to store your lon/lat:

  • select your layer
  • toggle to edit mode
  • open the attribute table
  • open the attribute calculator (ctrl+i)
  • name your column, choose the predefined geometry function $x, $y (in that dialog)

second solution (works for all gemetry types)

  • select your shp layer
  • save as ...
  • choose txt format
  • put GEOMETRY=AS_WKT in the OGR layer option

you will end up with a text file with the layer attributes and geometry as WKT

  • I just see the title of the post, so consider only the second solution :-)
    – user14131
    Commented Jan 10, 2013 at 15:45
  • These do not seem to work in version 3.03. Following the first solution, QGIS gives only null values in the new field. For the second solution, there seems to be no option for saving as .txt format. Commented Jun 21, 2018 at 23:15

You're looking at the right question, just not the right answer! The reason that that worked for the answer you were looking at is that the data was only in points. Since your data is in polygons, it won't work.

BWill's answer further down is what you need. It will copy all the co-ordinates describing each polygon into WKT format, which is a standard format, although you may need to do some cleaning up depending on your purpose.


Now there is a great plugin produced by Michael Minn that does exactly what you're looking for. Just update your plugin repository and install MMQGIS. I just tried it out and it worked great.


to provide a visual guidance(applicable to QGIS version 3.10.1-A:)

  • Navigate to Layer --> Save As
  • On the Format dropdown, select 'comma Separated Value [CSV]'
  • Provide the filename to save to
  • In the lower section, expand 'Layer Options' if not expanded (scroll down if required
  • Select 'AS_WKT' for 'Geometry'
  • Click OK

(You may want to play around withthe many options based on your needs) Save geometry as CSV


You could also use the MMQGIS plugin to export the geometry and the other layer attributes to a CSV file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.