Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am new to QGIS, and I am now trying to export polygon coordinates from a shape file to a csv file, but so far all my attempts have failed. I have found numerous questions and answers about this, but none have solved my problem.

I have downloaded the file

www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip

which is a shape file containing a basic world map. I have imported the shape file into QGIS by adding a vector layer, and then I try to export the polygons with coordinates for each country. The tips that I have found suggest either saving the layer by right-clicking it and then selecting Save as or opening the attribute table and copying it into Excel. If I try these I only get master information with one row for each country in the map.

Does anyone know how I can retrieve detail information for each country containing the polygons with coordinates?

share|improve this question
1  
So you want coordinates for all vertices ("corners") for all polygons exported? That could be quite a lot of rows. What you probably get now is the centroid. Can I ask what you need this for - maybe there's an easier way to accomplish what you want to do? –  Martin Aug 6 at 7:56
    
Would Well know Text(WKT) representation be enough for you? –  vinayan Aug 6 at 7:59
    
I am not familiar with WKT, but from what I have found on the web it seems that it will be a bit difficult for me to use. I need the data in a csv file. The shape file I am using here is only for testing, I will not use it in my work. I am working with some special geograpghical zones related to fisheries. These zones are stored in a database. I would like to import the shape file data into the database for comparison purposes. I was hoping that I could find a way of exporting the coordinates for one chosen country in my test file to a csv file and then import it into the data base. –  Sveinung Aug 6 at 11:05

3 Answers 3

up vote 4 down vote accepted

Use the plugin MMQGIS to export geometry to csv. I just try with your file, it works perfectly.

enter image description here

share|improve this answer
    
Great! I think this may solve my problem! Here I am able to connect attributes and nodes. The real files that I will be working with will be much smaller than my very large test file. I think this is just what I was looking for. Thanks a lot! Unfortunately my reputation is still too low to vote anything useful. –  Sveinung Aug 6 at 11:38
    
You welcome. By the way, you can successfully accept the answer even with low reput. ;) –  Leasye Aug 6 at 11:46

Choose Layer > Save As... with format as CSV. Make sure 'Layer Option', 'GEOMETRY' is set to AS_WKT in the 'Save vector layer as...' window. The first column of the CSV file will now include polygon coordinates.

share|improve this answer
    
That worked! I got the coordinates! However, it will be a bit awkward using them as I need the data in a CSV file. I don't know if there is any easy way of converting from this format to csv. But this was very useful. Thanks! –  Sveinung Aug 6 at 11:15

You can use this simple app to load a shapefile, and then export as X/Y's

http://www.qarah.com/shapeviewer/#download

share|improve this answer
    
That worked too! But here it seems I will have some problems connecting the coordinates to a country. If I export the attribute table with the country names I can find no obvious relation between the two data sets. I need both the master and detail information. But this is a neat little app that I will continue using. Thanks! –  Sveinung Aug 6 at 11:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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