2

I am working on a project for my university and this is my first solo project.

I have a land cover classification with 6 classes. I also have a set of points that are recorded sightings of a mammal we have been observing. I have imported these points into QGIS using their lat/long and now have them overlaid on top of my land cover classification. I now want to understand in which land cover classes these points/sightings have occurred.

If there are around 1000 points, how do I understand what percentage of them have occurred in each land cover class?

For example, if there were 12 points in areas classed as "urban" then this would equate to 1.2% of sightings of the animal being in urban areas.

1 Answer 1

2

You can achieve this using a virtual layer.

Go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the following query. Modify pt.cat for the name of your category field as well as the name of the layers.

You can then persist the layer if you wish.

WITH tot (select count(*) as cnt from myPointLayer pt)
select p.cat, 
    100.0 * count(*) / cnt as pcnt
from tot, myPolygonLayer p
join myPointLayer pt
 on st_intersects(p.geometry, pt.geometry)
group by p.cat
1
  • Thank you so much! And is this the only method or most simplest method do you know? As I'm not familiar with some of the terms used.
    – Kora Lae
    Sep 9, 2022 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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