2

I can't figure out how to work with a large dataset. The problem is: I want to know how many points (over 700 000 adresses) are within a polygon layer (it's made out of 5 layers, train noise)(they are both shapefiles). Using the 'Join by location' tool or 'Add polygon attributes to point' (SAGA) would take days to calculate it. I tried using a Spatial lite database and a Postgis database (SQL) but that also took way too long (10 attributes took over a minute to calculate). This is the script I used:

SELECT
bag_panden."id", trein_geluid_nacht."fromto"
FROM
bag_panden
inner JOIN
trein_geluid_nacht
ON ST_Within(bag_panden.geom, trein_geluid_nacht.geom)
where
bag_panden."id" <= 100

If anyone knows a way to calculate this faster I would like to know how. Maybe a different tool? Some Settings? A different script?

I am using QGIS 2.18.14

  • 2
    Isn't there some sort of select by location and then find the count of selected features? That's how I would do this in QGIS or ArcGIS (or OGR), it's less intensive than a clip or spatial join. – Michael Stimson Oct 15 '18 at 6:06
  • @MichaelStimson Thank you for your answer. I'm running the 'select by location' right now, but it's stuck at 0% for about ten minutes... (It seems to be working in the task manager) I'm afraid this would also take a lot of time – Guestname Oct 15 '18 at 6:29
  • Could you create subsets of either you polygon or your point data? – Erik Oct 15 '18 at 6:35
  • Is there a spatial index? Are both the selecting geometry and the query geometries in the same spatial reference? – Michael Stimson Oct 15 '18 at 6:39
  • 1
    @MichaelStimson I found the answer! I've downloaded the newest QGIS (3.2.3), applied 'Fix geometries' and then applied 'Join attributes by location'. It joined the point layer and the polygon layer. As result it gave me the point layer with the data of the polygon (when overlapping or else empty). It took about 45 minutes. Thanks for the help! – Guestname Oct 15 '18 at 12:47

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.