have a relatively large number of points ~3.5m and want to count the number of these within administrative boundaries (182 polygons). Point data is in a PostGIS db (through a materialized view) polygons are in simple shapefile (not in db)

Initially running the points in polygon just stalled my machine so I've tried breaking down the query using a filter on the points (which gives 150,000 points to count). This still doesn't run. I've tested the shapefile with very small (30) data set and no problems there.

My workround is to save out a shapefile, but i'd like to know why it's not working and if there is an alternate tool in QGIS i can try? Ultimately I want a basic choropleth map to show how many points in each admin area (polygon) Structure sqlI

  • Does your data have spatial indices built on both tables? Can you post a sample of your SQL? – DPSSpatial Jun 15 '17 at 16:40
  • I don't think it does / i don't know how to check or create one. Something along lines of this?dragons8mycat.com/2015/05/12/… – mapping dom Jun 15 '17 at 16:52
  • Just following this revenant.ca/www/postgis/workshop/indexing.html to see if that helps – mapping dom Jun 15 '17 at 16:56
  • I added a spatial index as above but no luck, i get the following error; Specified SAGA folder does not exist. Will try to find built-in binaries.Uncaught error while executing algorithm – mapping dom Jun 15 '17 at 17:40
  • oh sorry i see one of your datasets is in a shapefile - you can use the DB Manager to write a sql query to intersect the data and get your counts - is that something you'd be up for? I guess the last question is are you able to load the polygons into PostGIS? – DPSSpatial Jun 15 '17 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.