One very common application of GIS to ecology is to layer a set of vector polygons over a land cover grid (or some other land feature raster) and clip it to determine the percentage of the cover classes under each polygon. Thus, as a new user of QGIS I was kind of surprised that this operation was (apparently) not a readily possible in the QGIS program.
I did perform this operation years ago using ESRI software but I have been away from GIS for some time. For the QGIS program I have researched out several approaches that are claimed to work for this purpose and thought I would collect them here to see if more experienced users would comment on which is the better way to go.
- The simplest approach I have found is this suggestion (Clipping raster with shapefile in QGIS?) Assuming that the raster data is in a format that QGIS can load, you can do it inside QGIS with Raster -> Extraction -> Clipper. This is said to work as long as the clipping polygon shapefile has the same CRS as the raster? This approach seems very simple but I cannot say if it works as I find that I do not have the option Raster\extraction\clipper on my version of QGIS (2.18.17)? What is more I am not sure this will return the number of pixels (or %land cover class) under each polygon anyway?
- One very promising approach seems to be to use the LecoS (land cover analysis program) developed by Martin Jung. (https://conservationecology.wordpress.com/2013/04/01/another-lecos-update-and-more-to-follow-in-the-near-future/) This seem to be exactly the right operation but it might not something anyone can download and use without some background information? It appears that the LecoS plugin requires some routines from the python libraries including “scipy”, “numpy” and “pil (imaging)” in order to run on Windows. To install these python routines for Windows one can download the OSGEO4W Installer which I did (but I've also read that you must choose the “advanced Install” and I think I used the "routine" install when I did it) Is it possible to reload the advanced install of OSGEO4W over top?
That question aside, it is not obvious to me is how proceed with downloading the libraries (python-numpy, python-scipy and python-imaging) then selecting them and thus allowing one to use LecoS to clip and return the information sought. If anyone knows of a tutorial on how exactly to download and use this promising application I would love to read it.
I’ve read other suggestions but this is probably enough for now! Land cover analysis is an operation I intend to perform regularly so I'd like to find the simplest approach.
I need to point out that this question has perhaps already been addressed here:Clipping raster with vector boundaries using QGIS? I missed it earlier and therefore the first suggestion I made mention of (using the GDAL clipper tool) might be one solution to the problem. I did not find this tool initially because I did not have the "GDAL tools" plugin checked on the list. My error. However the clipper tool apparently only outputs the "clipped data" to another raster file. Ideally I would like the output the data to something like a dbase file for further manipulation and analysis.
Zonal raster statisticsunder SAGA - Geostatistics. Please be careful not to chooseRaster statistics for polygons, which is basically the same as QGIS Zonal statistics. – Kazuhito Mar 21 '18 at 12:30Zonal raster statisticsis a tool which takesZone grid(a categorical raster, from your polygon) andCategorical grid(land cover, in your case) and returns cell counts as per each combination ofZoneandCategorical. You can then calculate their percentage, too. – Kazuhito Mar 21 '18 at 13:08