0

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.

  1. 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?
  2. 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.

  • I think the tool you are looking for is zonal statistics. Here is a link to the zonal statistics plugin: docs.qgis.org/2.18/en/docs/user_manual/plugins/…. No library downloads are required. – GBG Mar 21 '18 at 4:04
  • @GBG Thank you for the suggestion but i did try the Zonal Statistics routine in QGIS. I believe this is a tool that might be useful for raster data that has a quantitative aspect (DEM) as contrasted to land cover data wherewith the number assigned to each pixel indicates qualitative aspects (e.g., 10 = grassland, 12 = cropland etc). Giving the "average land cover score under each polygon is not interoperable. Hopefully, I am not missing something here. – BernieD Mar 21 '18 at 11:44
  • @GBG Sorry I meant an average land cover (based on the number assigned to each cover type) is not interpretable. I need instead the total number of pixels (or percentage of pixels) for each land cover type under each polygon in my vector layer. – BernieD Mar 21 '18 at 11:56
  • If you don't mind converting your vector polygon into a raster, there is a QGIS processing - SAGA tool Zonal raster statistics under SAGA - Geostatistics. Please be careful not to choose Raster statistics for polygons, which is basically the same as QGIS Zonal statistics. – Kazuhito Mar 21 '18 at 12:30
  • @Kazuhito Thanks for the suggestion but I believe the SAGA zonal raster tool as well as the QGIS zonal statistics tool is intended for raster data where the number assigned to each pixel has quantitative meaning -- e.g., slope = 5. I am dealing with a land cover raster where the assigned numbers have qualitative meaning e.g,, 12 = "grassland". – BernieD Mar 21 '18 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.