I found the following link to a post saying that a count lines in polygons had been added to ftools for QGIS: http://hub.qgis.org/issues/4712

However I can't find how to access this feature nor any online discussion of how to do this - can anyone help?

Alternatively, are there any other tools that will allow this?

I have a hexagonal grid and want to count the number of animal track paths that go through each cell for a migratory distribution map.


2 Answers 2


I couldn't find the field count in the fTools anymore (QGIS 2.0). But I managed to get the number of lines within a polygon using the plugin MMQGIS. Assuming you have a line layer test.shp and a polygonlayer buffers.shp you have to do the following:

Choose MMQGIS > Combine > Spatial Join

Select the parameters:

Output Shape (Target) Layer: buffer.shp

Spatial Operation: Intersects

Data (Join) Layer: test.shp

Attribute Operation: First

Output File: example.shp

The output file example.shp contains the attribute count, which gives you the number of lines within each polygon.


As already mentioned in the QGIS wiki link you provided you can find the tool in the ftools sextante toolbox. The Name is "Sum Line length" and it needs a polygon and a line shape. It returns the absolute line length intersecting the polygon as well the number of lines. Returned values are added to the attributetable of the output.

enter image description here

If the toolbox doesn't show up, you have to activate it first (Sextant Toolbox options). If it still doesn't show up you probably have to upgrade your QGIS to the newest development version (1.9 Master)

  • The development version should not be used in production environments.
    – steko
    Commented Dec 18, 2012 at 22:54
  • 2
    why not? Because all new features aren't stable and results not verified? If you apply this logic in a wider frame, you shouldn't even use the user coded plugins because they are constantly changed and could give unverified results. This is an Open Source Project we're talking about and many OS-Projects use the bleeding edge of the available software. Trust your head instead of a version number! If you can't do this, then better stay with commercial software.
    – Curlew
    Commented Dec 18, 2012 at 23:59
  • You can run both 1.8 and master build side by side so you can use features like this from master then go back to 1.8 if it makes you feel safer.
    – Nathan W
    Commented Dec 19, 2012 at 0:35
  • Thanks so much for the guidance - I hadn't found this toolbox. This worked fine in QGIS 1.8.
    – KimS
    Commented Dec 19, 2012 at 1:06

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.