I'm making a map for a walking trail in QGIS. In the below screenshot, the red line is the trail.

my current map from Print Composer

The trail is about 60km in length in total, but on this page of the map, the trail is about 23km long (I eyeballed this, it's probably off by a bit).

The trail is a single, long line feature.

What I would like to do is have the length of the trail on this page of the map be displayed.

I know that I can get the total length of the feature, but I haven't got the faintest idea how to measure the trail on a per-page basis.

  • Which QGIS version are you using? It should be possible to create an expression which automatically updates based on the current map extent, but the format would differ in QGIS 2.x vs 3.x
    – ndawson
    Aug 21, 2018 at 0:04
  • Either, 2.18 originally but I just now updated to 3.2.
    – Carl Lange
    Aug 21, 2018 at 0:05

1 Answer 1


If you already have polygon features you are using to demarcate the edges of each map - a grid index or similar - you can just use this to split the line into multiple line features using the Intersect or Clip tools to calculate lengths individually (Vector overlay > Clip OR Intersection. Clip will simply return the original line attributes while Intersection will return the polygon attributes as well with the output feature layer, which may be helpful when referencing to a specific map). Reference this length on each map. The split lines layer can be turned off if you wish to use the full line feature and not have to mess around with multiple symbologies.

If you don't have anything to define map boundaries - from what I understand you're developing multiple maps to follow the route of this trail, so it may be worthwhile implementing some form of automation to make your job easier - you can use the PolyStrip plugin to perform this function (https://plugins.qgis.org/plugins/polystrip/). If you aren't already, you might also want to look into the Atlas functionality of QGIS, which facilitates the creation of a series of maps based on polygon-defined locations (this question Does QGIS feature a tool like ArcGIS Data Driven Pages? and a tutorial https://www.qgistutorials.com/en/docs/automating_map_creation.html)

  • I ended up using Polystrip and the Atlas functionality to do what I needed to create multiple maps - I haven't yet added the length of the trail on a per-map basis but I'm confident I can do so now. Thanks again.
    – Carl Lange
    Aug 22, 2018 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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