I have a large point dataset of about 5.3 million points. I would like to delete the "lonely" points using QGIS, for example all points with no neighbor within a 5 km radius. The extent of my point dataset limits some of the tools I guess...

I tried the Distance matrix en v.neighbours tools, but QGIS can't handle it and goes irresponsive... Is there another way to work around this problem for large datasets?

enter image description here

  • 1
    Make a dissolved Buffer and then delete those with area of a single buffer or less than something, in particular can be <= 5 km – Taras Nov 2 '19 at 21:33
  • Do you think this would work with such a large dataset? – user152287 Nov 2 '19 at 21:36
  • 2
    Irresponsive? Maybe you're just impatient :) Under Windows, open the Task Manager to see the QGIS CPU usage; that will inform you if QGIS is still chugging away at the task. – Stu Smith Nov 2 '19 at 22:30
  • 1
    As a rule, it's often better to keep features you don't want to delete during a copy than to delete features (and their indexes) directly.. – Vince Nov 3 '19 at 3:44
  • Quick possibility (haven't listed the commands so I wouldn't regard it as an answer) - buffer the points to 5km, then do a "count nodes in polygon" on the buffer. Ensure that there is some sort of primary key to link it back to the original layer. Link it back using a join, then delete any where the counted nodes =1 (as it will still contain the original node). – user25730 Nov 3 '19 at 22:20

As I understand it, v.neighbors outputs a raster that can hold the number of points within a set distance from each cell, but does not identify whether or not the points themselves have any neighbours (see the manual page).

Anyway, instead you could try a clustering tool, for example DBSCAN clustering. Set the minimum cluster size to 2 and maximum distance to 5 km. Using the default settings, points without neighbours will then get CLUSTER_ID set to null in the attribute table. If you then perform a selection using the expression "CLUSTER_ID" != 'NULL' and save the selected features, you should be left with a layer holding all points with at least one neighbour within 5 km (and still have the original data, as per the comment by Vince)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.