I am a complete loss when attempting to use QGIS to produce a csv file of points as latitude and longitude from shapefile data so that I can plot them on gores for a small world globe. All my attempts have resulted in just a list of consecutive numbers in a column. The data I have chosen has 250 points and that will be ideal for my purpose, a 55mm diameter globe to illustrate a talk on Mercator and the Ordnance Survey

I am using the data from http://openstreetmapdata.com/data/generalized-coastlines The shapefile set is the set from coastlines_z1 ... with extensions .dbf .prj .shp .shx I have tried to follow the instructions for QGIS in this reference,

1) Add a new layer
2) use the file coastlinesz1.shp
3) toggle editing
4) open the layer’s attribute table

At this point the table has only one column with the numbers 0 to 249 in it.

Somewhere along this process I have obviously made at least one mistake, please can anyone tell me where?.

I am sure that more will be needed, but there is a plethora of information out there and deciding what is relevant is beyond me at the moment.

3 Answers 3


The blog post you refer to is useful, but the technique it describes will only work with POINT shapefiles.

The dataset you're working with is a shapefile of type LINESTRING.

That means there are two fields; FID (the unique numbers you're seeing) and a "hidden" geometry column, which you don't see in the attribute table, which describes the list of coordinates in each line. Shapefiles are a bit odd that way, they keep the geometry in a different file (.shp) from the associated data (.dbf)

If you want a series of points from the lines, you can use Vector > Geometry Tools > Extract Nodes. This will create a point layer from your lines; from there, you can use the blog post you mentioned to add lat/lon columns.

I'm not sure QGIS/GDAL supports any interrupted projections which will display gores, though.

For that, i'd recommend you save your shapefile as GeoJSON, and use d3. That needs some JavaScript code, but there are plenty of examples available to cut-and-paste. You might also want to try the d3 renderer QGIS plugin, although I'm not sure it supports interrupted projections either.

  • Thank you Steven Kay for the answer and the edit, that makes good sense. It's late here, I will try that tomorrow, and surely accept it as the answer. No problem with the gores, I've written a Postscript (as Ghostscript) program that draws them, and it will be easy to scale the longitudes (as cosine of latitude) to suit. Latitudes are linear. Commented Jan 18, 2017 at 22:57

In case of point shapefiles not having coordinates, follow the procedure mentioned below:

Open the shapefile in QGIS and go to Vector menu and select Export/Add Geometry Columns under Geometry Tools option as shown below:

Export/Add Geometry Columns

Then save as a new shapefile as below.

create new Shp file

This new shapefile will have two more columns having latitude and longitude in .dbf file. You can also view these columns in layer’s attribute table as XCOORD (Longitude) and YCOORD (Latitude).

For line or polygon shapefiles you can use the method mentioned by Steven Kay.

  • perfect solution, works like a charm.
    – tony gil
    Commented May 18, 2018 at 10:45

An alternative way is to:

  1. Open the attribute table
  2. Select the rows
  3. Ctrl + c or use copy icon
  4. Paste into excel
  5. You will need to manipulate the data in the first column (find and replace and split-duplicates spring to mind)

The first column contains the geometry in well known text format. Essentially points are separated by commas and the x and y coords are separated by spaces.

This may not be the fastest or suit, but it is to show that the geometry can be copied out of the attribute table, even though it is not visible as a column.

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.