3

I have thousands of polygons (buffers) in a single layer and I have a points layer containing tree species. The tree species points shapefile has an attribute called Tree_Type. I need to select only the polygons that contain/intersect three particular species (as shown below). I've already tried multiple intersects to no avail. enter image description here

2

You can use first the processing tools "join attributes by location" and next "Dissolve" to remove duplicates. Yours polygons need to have a unique id attribute. enter image description here enter image description here enter image description here enter image description here enter image description here

3

Using the new virtual layer with the SQL script in the form window add 2 layers and run the SQL script:

SELECT DISTINCT (a.geometry) geom FROM buffer a JOIN tree_pts b ON ST_Intersects(a.geometry, b.geometry) WHERE b.tree_type='pear' OR b.tree_type='apple' OR b.tree_type='orange'

Save the result as a new file using <Export>-<Save objects as... >

2
  • I'm trying this in PostGIS now as QGIS was crashing. I've tried using AND to get each buffer that contains all tree_types but it doesn't work? I've also tried the above code with WHERE Tree_Type.Feature_Ty IN ('Apple', 'Pear', 'Orange') but this doesn't work either. Any thoughts?
    – Dunuts
    Dec 13 '20 at 9:19
  • I can assume that your polygon file has the wrong geometry... Dec 13 '20 at 9:47

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.