Calculating Raster Land Cover Statistics for Polygon Areas in QGIS

Contents

In this Topic Show

 

The following steps show how to use the LecoS – Landscape Ecology Statistics plugin ( https://conservationecology.wordpress.com/qgis-plugins-and-scripts/lecos-land-cover-statistics/ ) to calculate statistics for a buffer area of the underlying Land Cover raster dataset.

It has been tested with QGIS 2.12.3 – Lyon but may work with other version.

This assumes that the Land Cover 2007 Raster 25m dataset has been downloaded from Digimap and has been stored and uncompressed.

Getting Started

It is better to make sure that QGIS is set up so that all new layers are created in the British National Grid otherwise you need to manually set the projection for every layer:

1) Open QGIS

2) Go to Settings -->Options -->CRS

3) In the section Default CRS for new projects

4) Select ‘Automatically enable ‘on the fly’ reprojection if layers have different CRS’

5) Select EPSG:27700, OSGB 1936 /British National Grid from the dropdown

6) In the section CRS for new layers select EPSG:27000, OSGB 1936/ British National Grid from the drop down

  

7) If this is not available on the dropdown then click the icon to the right and on the Coordinate Reference System Selector form type: 27700 in the Filter field. This should bring back just one projection. Select the OSGB 1936 projection and click OK.

8) Open a New Project by selecting Project àNew and check that in the bottom right of the QGIS window it says EPSG: 2700

 

Load datasets

Load in the CEH Land Cover Raster dataset to QGIS:

1) Go to Layer -->Add Layer -->Add Raster Layer... select the TIF file from the Digimap Environment download.

Load in a CSV dataset of your sites of interest:

2) Create a text file that has the coordinates of your sites points in a comma delimited format

e.g.:

x,y,site_num

316143,671405,1

319157,676641,2

325900,674521,3

3) Use Layer -->Add Layer -->Add Delimited Text Layer

Browse for your CSV of sites, toggle on CSV (Comma Separated Values). Give it a Layer name of ‘sites_data’. Select the fields that contain the coordinates (x,y).

4) Click OK

5) Zoom in to the area of your sites (right click on the “sites_data” layer in the “Layers Panel” and select “Zoom to Layer”.

Create Buffers around the points

1) Use Vector -->Geoprocessing Tools -->Buffer(s)…

2) Select the Sites layer (sites_data) as the Input vector layer

3) Set Buffer distance to be 1000 (later do it at 500m)

4) Create an Output shapefile by browsing to a folder and entering a name e.g. buffer_1000

5) Click Save and then OK

7) You will have three datasets loaded now – the land cover raster, the sites points and the 1000m buffers around the points.

Clip the Raster so it is just bigger than the area of interest

1) Use Raster -->Extraction -->Clipper…

2) Zoom and pan the window so that just the area of your points is shown on the map

3) Select the Landcover raster (lcm2007_25m_gb) as the Input file

4) Select an Output file by navigating to a folder and entering a name e.g. landcover_clipped of type TIF

5) Toggle On No data value and set it to be 0

6) Set Clipping mode to be “Extent”

7) Select the area to be clipped by clicking and dragging the box on the map

8) And select OK

9) Close dialogs that appear and Close the Clipper.

After Clipping, set the Coordinate System of the Clipped raster.

1) Set the coordinate system of the clipped land cover dataset to be EPSG 27000/ British National Grid by right clicking on the land cover dataset in the Layers Panel and selecting Set Layer CRS.

 

Choose OSGB 1936 /British National Grid (or filter by 27700 if it’s not in the list) and click OK.

2) Remove the original (lcm2007_25m_gb) by right –clicking on the layer in the Layers Panel and selecting Remove.

3) Drag the buffer_1000 and sites data above the Landcover_clipped in the Layers Panel so that they are visible.

Set Representation of the Clipped Raster

The representation of the clipped dataset will appear different (in shades of grey).

1) You can load the previous representation by right clicking on the landcover_clipped layer in the Layers Panel and selecting Properties and selecting the Style tab on the left.

2) Then select the Style dropdown near the bottom and click Load Style.

3) Navigate to the folder that contains the original landcover raster data downloaded from Digimap and select the QML file in the folder where the original TIF was.

 

The map display should now look like that below, showing the Landcover dataset with the buffer polygons.

Analyse areas under the buffer regions

To analyse the buffer polygons we will use the third party QGIS plugin called LecoS. There may be other ways to do this analysis but this tool provides a relatively easy and powerful means of analysing the data, however there are no guarantees with this software.

1) Do this using a plugin called “LecoS” (Landscape ecology statistics)

2) Go to Plugins -->Manage and Install Plugins and scroll down the list till you find:

LecoS – Landscape Ecology Stats and select it then click Close.

You can find out more about is by following the links in the help pages.

Using LecoS Landscape Ecology Statistics

1) Select Raster -->Landscape Ecology -->Landscape vector overlay

2) Set Landscape layer to be landcover_clipped

3) Set Overlaying grid to be the buffer dataset buffer_1000

4) Select Class under Settings and choose which class you are interest in e.g. 4 for Improved Grassland

5) Set Vector grid ID to be the site column name on the drop down e.g. site_num

6) Toggle on Save in attribute table

7) Toggle on Save in file and select a destination file to save the results in e.g. class4.csv.

8) Select Landscape Proportion under Selected Metrics

9) Click OK and then Cancel

Viewing Results

The proportion of the chosen class in the area of the buffer will be stored as an attribute on the buffer feature. You can see it by:

1) first selecting the ‘buffer_1000’ layer in the Layers Panel

2) then selecting the ‘Identify Features’ icon in the top toolbar ( )

3) then clicking on the buffer feature in the display.

4) the attribute will be displayed in the “Identify Results” panel

  

However, it may not be visible unless you Remove the buffer dataset and re-add it to the map using the Layer -->Add Vector Layer --> FIle

It will also create a CSV dataset that has the attributes in it.

If you want the statistics for multiple classes you will need to run the process multiple time changing the Class number in the form and change the name of the saved CSV file.

The LanPro attribute value is the proportion of Landcover in the selected class. In this case a value of 0.2559 means that 25.59% is in Class 4.

More information about the plugin can be found at: https://conservationecology.wordpress.com/qgis-plugins-and-scripts/lecos-land-cover-statistics/

And the published article at: https://peerj.com/preprints/116v2/

Guy McGarva

March 2016