I am trying to use QGIS to find points within 5 meters of each other that all have a value of <50% for a given parameter that has been loaded through a CSV file. I looked in to doing it with a spatial query, but I only have one vector layer.

The CSV file I have loaded in has about 10 parameters such as the percentage value, lat, long, name, etc. Is it possible to search through these points based on distance and the percentage identifier with only using one vector layer (that is, not with spatial queries)?

Edit: Here is an example with a screenshot.


The colours are coordinated with the percentage values I mentioned above. I'm looking to do a search for groups of points that are below 50% and within 5 meters of each other. The black circle wouldn't have any but the cluster of red with the one green to the right should be caught within the search.

  • Is the CSV joined to your point data? That would be my first step. It's a bit unclear as to the relationship between the CSV and your point data. Please edit your question with an example, maybe a screen shot and further clarify what you mean.
    – GISHuman
    Nov 10 '15 at 23:33

Probably Virtual layer will be helpful.


  • Layer: your_layer.csv
  • Value: less than 50% (or <0.5)
  • Within: 5 m

Virtual Layer

(1) Layer | Add Layer | Add/Edit Virtual Layer then [Import] your_layer.csv

(2) Query is:

SELECT a.id, b.id, a.geometry
FROM your_layer AS a 
     INNER JOIN your_layer AS b
             ON a.id <> b.id AND (st_distance(a.geometry, b.geometry) < 5)
WHERE  a.value < 0.5 

(3) Click [OK]

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.