My problem is very easy to understand but I can't find a solution.

I'm actually working on the spreading of a local optic fibre network. These fibres will be contained in plastic tubes buried in trenches. I need to know how many tubes we should bury in each trench.

In GIS words : I make a buffer from the polyline shapefile "trenches", and I need to know how many polylines from the "tubes" shapefile cross (all the lines starts and ends out of the buffers) this buffer, then create a new shapefile with a column containing this count.

I though that there was a geoprocessing tool which could do it just like the "count points in polygon" geoprocessing tool. But it doesn't exist in QGIS Version 2.14.13.

So, I'm looking for a similar method that could be integrated in a graphical modeller, as a one-click operation (because I'll have to do it several times, and so will do my colleagues).

  • Could you upload an image that explain graphically the problem? Apr 24, 2017 at 10:10

1 Answer 1


You could use the Join attributes by location tool (which hopefully should in available in your modeler). If you select the Attribute summary option and choose Take summary of intersecting features, it will insert a Count field into your layer. If you don't want to calculate the sum, mean etc then just remove them so that the textbox is blank, that way you will only get the Count field as the statistic:

Join attributes by location

  • 1
    Of course ! I was searching for very complex methods since days but just forgot the easiest...Thanks a lot, Joseph !
    – Drawfib38
    Apr 24, 2017 at 12:10
  • @Drawfib38 - Most welcome! Glad it helped :)
    – Joseph
    Apr 25, 2017 at 8:56
  • To obtain these options in QGIS 3, one has to use the tool "Join attributes by location (summary)"
    – Kantan
    Jun 27, 2023 at 7:46

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.