I have a points layer with a column that separates the points into different types (eg 'high', 'medium', 'low'). I need to count the number of points within polygons, for each of the different types. At the moment, I'm doing it by creating a separate points layer for each of the types and then running the points within polygon tool for each of them. I was just wondering if there's a tool that lets you run points within polygon but with conditions, so that I could run it for those points where the type is 'high' etc?
SQL is the answer !
You can achieve this using the DB Manager of QGIS.
You choose Database / Database Manager / Database Manager then Virtual Layers / Qgis Layers you can then try queries like the following :
SELECT count(*), pt_type from pt_layer, poly_layer where st_intersects(pt.geometry, poly.geometry) group by pt_type
pt_layer being your point layer and poly_layer being your polygon layer...
You can then load the result in the layer manager.