4

I want to draw a line in QGIS and then, export the long-lat of each point into a Comma Separated Value (csv) file. I tried doing this by creating a new shapefile layer and then using the Add Feature tool to draw my line. I then tried to export my line via Save As on the layer and exporting as CSV.

Unfortunately, the only thing that gets saved to the CSV file is the id of the layer. I've been unable to figure out how to export the coordinates. Some help please.

8
  • Is the line in geographic coordinates or projected coordinates? If it's projected then you have to make it geographic then read this gis.stackexchange.com/questions/24442/… or this gis.stackexchange.com/questions/28092/… The confusing part is they talk about vertices as nodes. Commented Sep 9, 2014 at 0:08
  • Where do I check for geographic vs projected coordinates? Commented Sep 9, 2014 at 0:21
  • The layers' CRS (coordinate reference system). You would have specified it at the time of creating the spatial lite layer, look up the spatial reference on Google if you're not sure. It will either come up as PCS (projected) or GCS (geographic). Commented Sep 9, 2014 at 0:24
  • So it's set to WGS84. Is that geographic? Commented Sep 9, 2014 at 0:28
  • WGS84 is WGS84/UTM isn't. Try exporting it and see if the numbers are big (much greater than 360) or small (less than 180) - small numbers mean geographic (in this case, don't use that as a rule though it's a good guide). Commented Sep 9, 2014 at 0:30

2 Answers 2

5

To get a CSV file from the line vertices is a two step process:

First, export the vertices (nodes) to a shapefile (explained Converting Polygon into single or all Points using QGIS?). Find the Vector pulldown, about halfway down is Geometry Tools, in that sub menu the bottom one is Extract nodes, fill in the blanks and add to view.

Next export the points to a CSV file (explained Getting list of coordinates for points in layer using QGIS?) right click on the layer, select save as and specify comma separated as the format, in the layer box put GEOMETRY=AS_XY - this is important or you will only get the attributes.

2

The MMQGIS plugin is able to export the vertices coordinates in one step.

Just make sure the layer is in EPSG:4326.

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.