it is the first time that I’m using the QGIS graphical modeler and I found some troubles (QGIS 2.14.1). I’m trying to count points that intersect with polygons in a vector grid, but filtering the points shapefile depending on several queries based on the attribute table. I want to do a first query and count the points, and do a second query and repeat the counting, saving both counts in the same layer. I was getting wrong results when I applied “select by expression” algorithm, even thought when I saved the selected features in an intermediate temporal shapefile before perform the counting. Using this model, I get in both counts the same results, just the one that correspond with the last selection.

enter image description here

Looking for in the web how to solve this problem, I found a solution in this question QGIS modeler: select by attribute wrong results , using “Extranct by attribute” instead of “select by expression” algorithm. If I’m not wrong it seems that it is a bug, so I will report that problem.

enter image description here

However, what I noticed is that if I perform the counting with the modeler take much more time that using the option that is in menu Vector>Analysis tools>Points in Polygons. I have read in the change log of QGIS 2.14, that PointsInPolygon processing algorithm is many magnitudes faster. It is really faster, but not when using the modeler. My question is if is there any way to use the new processing algorithm in the modeler?

1 Answer 1


I think you are a little confused. The Vector > Analysis tools > Points in Polygons tool is not part of the Processing plugin, it is a core tool of QGIS. There are some tools from both the said plugin and core QGIS which are similar. However, you will have to use the Processing plugin version of the tool in the modeler.

The QGIS 2.14 Changelog does indeed mention:

PointsInPolygon processing algorithm is many magnitudes faster

However, there is a possible issue if you have previously installed QGIS which is that the python script for the tool (in the Processing plugin) seems to vary slightly between the one bundled with QGIS 2.14 and the recent 2.12.2 version (which is normally in /.qgis2/python/plugins/processing):

Script difference

Where the left script is the one bundled with QGIS 2.14; the right script is from Processing 2.12.2. The coloured lines shows any differences between the two scripts.

Therefore, I would suggest copying over the script that came with QGIS 2.14 (which is on a path like /QGIS Essen/apps/qgis/python/plugins/processing/algs/qgis/PointsInPolygon.py and replace the one in /.qgis2/python/plugins/processing/algs/qgis/PointsInPolygon.py. Then load QGIS and try out your model.

  • 1
    You are totally right... I thought that the Processing plugin worked with the same algorithms that were included in the core of QGIS (at least those that are in the modeler inside the option of “QGIS geoalgorithms”). Thank you for clarify this point. I will try your suggestion and I will report if results or not. Thank you again for your time and effort.
    – A. Forcada
    Commented Apr 13, 2016 at 16:53
  • @A.Forcada - Most welcome! I thought exactly the same when I first got involved in QGIS! Hope you get the results you're looking for =)
    – Joseph
    Commented Apr 14, 2016 at 12:46
  • Excuse me Joseph, but I don’t find where to replace the script file, because I do not have the same path. Inside the path /.qgis2/python/plugins I only found a folder called /expressions . Should I create the folder /.qgis2/python/plugins/processing/algs/qgis/PointsInPolygon.py? Thanks again
    – A. Forcada
    Commented Apr 18, 2016 at 17:59
  • @A.Forcada - I suggest you download the latest version here and extract the zip file to the /.qgis2/python/plugins/ path. Make sure to restart QGIS if you have it loaded.
    – Joseph
    Commented Apr 19, 2016 at 13:12
  • 1
    I downloaded the last version as you suggested with success, but replacing the files I don’t get better results. I think that both algorithms are from the Processing plugin. I mean, in the folder /QGIS Essen/apps/qgis/python/plugins/processing/algs/qgis/PointsInPolygon.py are the algorithms of version 2.12.99 (which is installed by default in QGIS 2.14.1), and in the folder /.qgis2/python/plugins/processing/algs/qgis/PointsInPolygon.py are the algorithm of the 2.12.2. However I don’t find the algorithms PointsInPolygon that is used through the menu Vector->Analysis tools. Thank you again.
    – A. Forcada
    Commented Apr 22, 2016 at 10:55

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.