2

I have a list of point features each with a unique "ID". I need to run a fixed distance buffer on all 70,000 points to establish which points are within a fixed distance of each other than return the unique "ID"s for each point. These need to be within columns in the attributes table.

So point 1 (id-A) might have point 9 (id-x) and Point 87 (id-c) within 1 km. I need the attributes table of point 1 to list id-A, then id-x then id c, all in columns for export to Excel where I can concentrate them with comers in between.

2

You can generate such list using a virtual layer, no need for excel nor to have an undefined number of columns

go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the query

select a.id, a.geometry, group_concat(b.id) as near_ids, count(b.id) as near_count
from mylayer a 
 left join mylayer b 
   on PtDistWithin(a.geometry,b.geometry, 1000)
      and a.id <> b.id
group by a.id

Note that this query filters out itself (that is, point 1 is not consider as being near itself).
The distance is in the same unit as the projection.
By default, group_concat adds a coma between outputs.

Bonus: it also counts the number of nearby points for you!

|improve this answer|||||
  • Very clean one! :) – RafDouglas Oct 10 '19 at 12:38

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.