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've got a layer in QGIS that is comprised of points. Its attribute table doesn't have (show) the corresponding x and y coordinates for each point. Is there a way for me to extract a list of coordinates for those points? (ideally into a CSV, but not required)

Also, for the exported list of coordinates (say, in a CSV file), how do I include the existing attribute table with it? Thanks.

For your information, I am running QGIS on Mac OS X 10.6.7.

share|improve this question
1  
Perhaps this is a duplicate of this question: gis.stackexchange.com/questions/7199/… –  djq Apr 22 '11 at 15:42
1  
You might be interested in my answer in another thread gis.stackexchange.com/questions/1721/… –  Willy Mar 28 '12 at 8:53
add comment

5 Answers 5

up vote 16 down vote accepted

Depending on your version, you should be able to right-click on the layer you want to export, and select Save As... Choose Comma Separated Value from the dropdown list of the dialog box that appears. Then, in the Layers part of the OGR creation options, type GEOMETRY=AS_XY or GEOMETRY=AS_XYZ depending on the dimensionality of your source data.

QGIS Save vector layer as... dialog

share|improve this answer
    
That's great and it works! One more thing: Can I also export columns I already have in the original layer's into the CSV, along with the X, Y coordinated? Thanks. –  hpy Apr 22 '11 at 16:34
1  
Cool, glad it works! Make sure you have the "Skip attribute creation" checkbox unchecked. I'm not a fan of negative checkboxes like that, it always makes me think twice about what state I need it in. –  MerseyViking Apr 22 '11 at 20:28
    
Got it, thanks! –  hpy Apr 22 '11 at 20:48
    
Very useful tips! –  Heinz Jun 11 '13 at 9:27
add comment

You may like this for the added detail which is gathered

For QGIS 1.7 on Win7 I open the attribute table for the layer, use the buttons to; invert selection to select all rows, copy to clipboard

and paste into Excel. The first column contains Well Known Text information which maybe more useful to you.

Edit

I now use the plugin mmqgis to export geometry to csv, it is more desired by CAD users at the other end...

share|improve this answer
    
BWill, should we merge your other account @Willy? That would help your reputation and simplify your interactions here. –  whuber Apr 13 '12 at 14:42
    
Restored original edit. –  Kirk Kuykendall Apr 16 '12 at 14:33
add comment

It is simple in the attribute calculator you may use $x and $y to calculate your coordinates into a new attribute.

share|improve this answer
add comment

for your question if you have postgressql and built-in postgis you can do this adding new column which is named coord_x and coord_y. and sql to update this column is:

UPDATE table_name
      SET coord_x = X(the_geom),coord_y = Y(the_geom);

that is it :)

share|improve this answer
add comment

Yes, in fact I asked a similar question a few weeks ago. It's only true for QGIS 1.7 though (which I'm running on OSX and it seems quite stable).

share|improve this answer
add comment

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.