I want to use QGIS creating points along the line, but in specified distance. I found two GRASS tools in SEXTANTE Toolbox:

  • v.to.points
  • v.segment

I tried v.to.points, setting the maximum distance between points in map units to 100 and got this:

points along the line

close look

The second photo showed a close look from the upper one. The result was what I want, but I want to get less points, but even I set the maximum distance to 1000, or 1000000, the result was the same.

I tried to use v.segment, but I had no file containing segment rules.

Underdark gave me some advice, and I tried Densify geometries given an interval. First it gave me a polyline shapefile the same as I input, and then I used extract nodes to try to get those points. But the result was the same as I got using v.to.points, no matter what I set the distance interval.

How can I create points along the line, and in specified distance?

  • 4
    Have a look at this, let us know nathanw.net/2012/08/05/…
    – Willy
    Commented Jun 11, 2013 at 11:02
  • Thanks for giving me this helpful advice! If I want to use your script, have I to install python? or in the new version QGIS 2.0, does it already have this function built in it?
    – Heinz
    Commented Dec 3, 2013 at 8:58
  • 5
    There is a plugin for this now in QGIS 2.0, called QChainage. Fetch the plugin and install it.
    – Willy
    Commented Dec 8, 2013 at 8:53
  • Note that the "Sextante" toolbox is called "Processing" in QGIS 2.2.0+ and the the Densify geometries given a an interval" is under the ProcessingToolbox/QGISGeoalgorithms/VectorGeometryTools menu. Note that this denifies the geometry and doesn't remove vertices that are closer than the the chosen interval.
    – Dave X
    Commented Jul 22, 2014 at 20:18
  • This worked for me: plugins.qgis.org/plugins/LocatePoints
    – user2821
    Commented Sep 6, 2016 at 13:38

7 Answers 7


There is now a plugin called QChainage that does exactly what you want. You specify an interval distance and the plugin creates points along your line at the specified interval.

  • *Note that this won't capture your line nodes, so if you need them you will also need to use the geometry tool - extract nodes and append to your chainage points.
    – Jason
    Commented Jun 25, 2014 at 3:15
  • 1
    Welcome to GIS SE! I think the information that you have appended here as a Comment would be better incorporated into your actual Answer by using the edit button beneath it. You can do this with a Copy/Paste and the delete your comment by clicking the little cross next to it.
    – PolyGeo
    Commented Jun 25, 2014 at 3:49
  • This is exactly what I needed! thank you! Not the same use case as the question, but I needed to find coordinates diff distances from a specified point, I used a diff plugin to draw the line, then used the layer it created with the plugin you mentioned and got what I needed! :D
    – Adam Pine
    Commented Jan 7, 2020 at 21:21

In the Python console:

1) create a memory layer class (complete class (without attributes) at crea_mem_layer.py)

class Create_vlayer(object):
    '''creation of a virtual layer''' 
     def __init__(self,nom,type):
         self.name = nom
         self.layer =  QgsVectorLayer(self.type, self.name , "memory")
         self.pr =self.layer.dataProvider() 
     def create_point(self,geometry):
         # add point to the layer
         self.seg = QgsFeature()
     def display_layer(self):
         #end of layer and display layer 

2) vector algebra functions (from algèbre_vect_PyQGIS.py)

import math 
def mag(point):
    # magnitude of a vector
    return math.sqrt(point.x()**2 + point.y()**2)
def diff(point2, point1):
    # substraction betwen two vector
    return QgsPoint(point2.x()-point1.x(), point2.y() - point1.y())
def length(point1,point2):
    # with PyQGIS: sqrDist
    return math.sqrt(point1.sqrDist(point2))

3) direction cosines

def dircos(point):
    cosa = point.x() / mag(point)
    cosb = point.y()/ mag(point)
    return cosa,cosb

4) process line or line segments

def pairs(list):
    # list pairs iteration 
    for i in range(1, len(list)):
    yield list[i-1], list[i]

layer = qgis.utils.iface.activeLayer()
# interval between points
interval = 5 m
# create virtual layer
gen_pt  = Create_vlayer("mid5", "Point")

for elem in layer():
    line = elem.geometry()
    for seg_start, seg_end in pairs(line.asPolyline()):
       line_start = QgsPoint(seg_start)
       line_end = QgsPoint(seg_end)
       # mid point = vector coordinates [x2-x1,y2-y1]
       pointm =diff(line_end, line_start)
       # direction cosines of the segment
       cosa,cosb = dircos(pointm)
       # length of the segment
       lg = length(line_end, line_start)
       # generate and add points to the virtual layer 
       for i in range(interval,lg,interval):
           gen_pt.create_point(QgsPoint(line_start.x()  + (i * cosa), line_start.y() + (i*cosb)))

# display layer


polyline, equidistant point with Shapely or PyQGIS2, with direction cosines


Then just adjust the interval

  • From looking at the junction, it looks like it keeps the pre-existing node points on the line, so it can't thin them to a resolution less than the vertices already on the line. With complicated, curvy lines as in the OP, these procedures may not have much of an effect.
    – Dave X
    Commented Jul 22, 2014 at 20:01
  • you can perfectly adapt the script.
    – gene
    Commented Jul 22, 2014 at 20:32

In QGIS 3 (at least in QGIS 3.10) there is a processing tool for that purpose: "Points along geometry"

enter image description here

  • Simplest answer. This should be the most upvoted answer nowadays...
    – juminet
    Commented Oct 12, 2021 at 9:04
  • I confirm tools are by now (QGIS 3.16) native in QGIS. For one example see link. Be just careful of the SRC of your data, the offset is expressed in this unit (degres, meters, ...)
    – kFly
    Commented Nov 3, 2021 at 0:18
  • As at QGIS 3.30, this is still the way to go... Commented Aug 11, 2023 at 7:44

I've written a script that changes the Sextante Densify geometries tool to accept a certain distance. It's called Densify geometries given an interval.

After running Densify, you can extract the points using Extract nodes tool.

You can get it from Github and install instructions are on my blog.

enter image description here

  • It appears this tool is now available in QGIS without the Sextante install (QGIS 2.18.7). I didn't see it in the menus, but found it as a QGIS geoalgorithm while searching in the Processing Toolbox. Commented Jun 4, 2018 at 13:29
  • This tool is available in QGIS 3?
    – Marco
    Commented Dec 30, 2019 at 22:04

If you don't want to horse around with python scripts you can simply install and use the "Profile from line" plugin and ignore / delete the raster value column. The chainage will be whatever you set teh sampling interval to be.

  • In QGIS 2.2.0, I see a "Profile tool", "qProf" and "VoGIS-ProfilTool", but not a "Profile from line" tool.
    – Dave X
    Commented Jul 22, 2014 at 20:05

Well not sure if this is in the stable release, but in the sextante toolbox on 1.9 alpha under Geoalgorithims->Vector is the "Convert Lines to Points" option. Works a treat, be great if it added a field for distance along the line as well though.

Interesting it did add the NAME field from my vector layer though.

I tried getting that Python Script by Nathan Woodrow working, but I suck with python. And with code in general it seems.


I spent a long time struggling with this issue, but eventually got more-or-less what I was looking for using QChainage. What I would like to share is something that may help others. When using the SAGA geoprocessing dissolve tool on the line, QChainage produces incorrect results. Use of a different dissolve tool causes it to work fine.

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.