I need an export of xy-coordinates of line segments in QGIS. I found an answer to a similar question here but that concerned only xy of the first and last vertex of a line segment. But I need the coordinates of all the vertexes. Can someone help?

7 Answers 7


The Geometry Export To CSV part of the mmqgis plugin enables you to export the node coordinates into a csv file.

This page should give you some hints on how to use the plugin:



There's a tool in the open source GIS Whitebox Geospatial Analysis Tools (http://www.uoguelph.ca/~hydrogeo/Whitebox/) called 'Extract Nodes'. It does exactly what you are looking for. It takes a shapefile of polylines or polygons and returns a vector of the node points.

enter image description here

  • To the down-voter, why would you downvote this answer? It solves the OP's question. It describes a tool that can take a shapefile of polylines and outputs a shapefile of node points. That's exactly what they are looking for. I'm really starting to think that I need to abandon GIS stack exchange.
    – user21951
    Sep 27, 2013 at 14:13
  • I did not downvote your answer, but the asker wanted to do it with Quantum GIS. Don't bother about someone not liking your answer, though. It might be useful to someone.
    – AndreJ
    Sep 27, 2013 at 14:32
  • @AndreJoost, Thank you for your comment. Just because a poster specifies a specific software package though doesn't mean that they wouldn't be willing to try a different tool if it solves their problem in a more straightforward way. It's usually, though not always, the problem that is more important than the software. If this isn't the case then we've failed to educate GIS users to be spatial problem solvers rather than button pushers. I like to think that's not the case.
    – user21951
    Sep 27, 2013 at 15:05
  • @AndreJoost Is there a way to extract the same end coordinates of a line using Python? Considering I have a PolyLine shapefile?
    – Akhil
    Sep 24, 2014 at 4:53
  • Sorry, I can't help you out with Python code. Maybe you put this a s a separate question, asking for a Python solution.
    – AndreJ
    Sep 24, 2014 at 5:26

Use extract nodes. From line to points => saved in shape file. Then save the point shape file in save as vector layer window as csv. In the layer option, change the following : create csvt = yes, geometry = as xy, separator = comma. Check the extent (current layer). Supply the file name, then click OK.


A Greek way:
A) Select the feature you want, copy it and paste onto a word processor.
B) delete the first part wkt_geom… and the parenthesis at the end so there are only numbers.
C) Replace: , (comma and one space) with ^p (MS word) or \n (Libre office-Open office).
D) replace one space with comma. You get the list of coordinates in the X,Y format.


Have a look at the following related answered questions:

If those don't work for you, please provide more details.

  1. Use the Extract vertices function to create a point shapefile of the vertices. The properties of the line (such as ID) will be retained for later reference
  2. Add the xy geometry properties in any number of ways, perhaps with the Attribute Table field calculator to add attributes named xx and yy with $x and $y in the calculation, or simply the Add X/Y fields to layer function, or other means.
  3. Export the points layer as a CSV format (if needed, or whatever format you want).

In fact we do not need any plugin or special function to extract vertices from linestrings or polygons. Simply create a memory point layer (see link), copy your selected features to this layer and open the attribute table to copy the vertices to the clipboard. BTW you can always set the point layer to a different CRS if you like, coordinates are transformed automatically. For more see: Programmatically extract edge points from many polygons?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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