How to export Polygons to CSV with coordinates?

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


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.

Tags:

Csv

Qgis