eyecatch

Habitat Suitability Analysis Using a Grid

Published: Last updated:
This article uses QGIS 3.34. The current LTR is 3.44.

What you'll learn


  • Analysis methods using a grid (mesh)
  • How to aggregate information into a layer's attributes
  • How to analyze suitable habitats for organisms

Recommended for


  • Anyone who wants to analyze habitats of organisms with GIS
  • Anyone who wants to learn the basics of grid analysis

Introduction

In ecology and conservation, analyzing suitable habitats is essential for protecting organisms. There are many ways to do it, but GIS can analyze suitable habitats based on geographic conditions, which makes it faster to identify suitable areas.

This article introduces a method for analyzing habitat suitability for organisms in QGIS.

How habitat suitability analysis works (created by processing Fundamental Geospatial Data (Geospatial Information Authority of Japan), “National Land Numerical Information (River)” (Ministry of Land, Infrastructure, Transport and Tourism), and the 5th National Survey on the Natural Environment vegetation survey results (Biodiversity Center of Japan, Ministry of the Environment))
How habitat suitability analysis works (created by processing Fundamental Geospatial Data (Geospatial Information Authority of Japan), “National Land Numerical Information (River)” (Ministry of Land, Infrastructure, Transport and Tourism), and the 5th National Survey on the Natural Environment vegetation survey results (Biodiversity Center of Japan, Ministry of the Environment))

Habitat suitability analysis method

The method in this article divides the target area into a grid (mesh) and tallies environmental conditions, such as slope and vegetation, for each grid cell. It then scores each cell: 1 point if one condition is met, 2 points if two are met, and so on. The higher a cell's total score, the more suitable the area is judged to be.

Overview of the analysis
Overview of the analysis

This article analyzes habitat suitability for an organism that prefers the following environment. For your own target organism, compile information on its preferred environment from the literature.

  • Prefers high elevation
  • Prefers forested areas
  • Prefers environments near water

To extract these conditions with GIS, this article uses the Fundamental Geospatial Data elevation model (Geospatial Information Authority of Japan, GSI), and the Forest Area Data and River Data from National Land Numerical Information. Prepare the data that fits your target species and conditions.

Preparing the data used (created by processing Fundamental Geospatial Data (Geospatial Information Authority of Japan) and “National Land Numerical Information (Forest Area, River)” (Ministry of Land, Infrastructure, Transport and Tourism))
Preparing the data used (created by processing Fundamental Geospatial Data (Geospatial Information Authority of Japan) and “National Land Numerical Information (Forest Area, River)” (Ministry of Land, Infrastructure, Transport and Tourism))

Habitat suitability analysis steps

Create the grid

First, create the grid data for the analysis. Create the grid over the survey area for the habitat suitability analysis.

To create the grid, run Vector → Research Tools → Create grid.

Use these settings:

  1. Grid type: select Rectangle (Polygon).

  2. Grid extent: specify the area where you want to create the grid. Click the ▼ button on the right to specify the extent of a layer or the area currently shown in the map canvas, or to specify an area on the map.

  3. Horizontal spacing: specify the east-west size of one cell. This example uses 50 meters.

    A smaller grid size gives a more detailed analysis but can take longer to process. Choose the grid size based on the target organism's range of movement and the size of the analysis area.

  4. Vertical spacing: specify the north-south size of one cell. This example uses 50 meters.

  5. Grid: specify where to save the data.

Settings for Create grid
Settings for Create grid

When you run the algorithm, QGIS creates grid data with the specified extent and size.

Preparing the data used (created by processing Fundamental Geospatial Data (Geospatial Information Authority of Japan) and “National Land Numerical Information (Forest Area, River)” (Ministry of Land, Infrastructure, Transport and Tourism))
Preparing the data used (created by processing Fundamental Geospatial Data (Geospatial Information Authority of Japan) and “National Land Numerical Information (Forest Area, River)” (Ministry of Land, Infrastructure, Transport and Tourism))

Condition 1: prefers high elevation

The first condition is a preference for high elevation. Aggregate the elevation values for each grid cell, and score 1 point if the mean is 150 m or higher and 0 points otherwise.

To aggregate raster values for each grid cell, open the Processing Toolbox and run Raster analysis → Zonal statistics.

  1. Input layer: the grid layer
  2. Raster layer: the elevation layer (the raster with the values to aggregate)
  3. Statistics to calculate: select Mean
  4. Zonal Statistics: specify where to save the data and the file name
The Zonal statistics dialog
The Zonal statistics dialog

When you run the algorithm, QGIS outputs a layer. In its attribute table, the _mean column holds the mean values.

Result of the zonal statistics
Result of the zonal statistics

Next, classify each cell by whether this mean is below 150 or 150 or higher.

Open the Field Calculator from the attribute table.

  1. Select Create a new field.
  2. This example uses dem for the field name, Integer (32 bit) for the type, and 10 for the length.
  3. Expression: if( "_mean" >= 150,1,0)
The Field Calculator dialog. The expression writes 1 if the _mean column is 150 or higher and 0 otherwise.
The Field Calculator dialog. The expression writes 1 if the _mean column is 150 or higher and 0 otherwise.

After you apply these settings and click OK, a dem column is added to the attribute table. It holds 1 where _mean is 150 or higher and 0 otherwise. The scores for the remaining conditions are added to this layer's attributes in the same way.

Result of the Field Calculator. Values of 1 or 0 are filled in.
Result of the Field Calculator. Values of 1 or 0 are filled in.

Condition 2: prefers forested areas

For the second condition, “prefers forested areas,” a grid cell scores 1 if a forest area lies within it and 0 if it does not.

How grid cells that overlap forest areas are determined
How grid cells that overlap forest areas are determined

To check whether each grid cell contains a forest feature, use Select by location.

  1. Select features from: the grid layer
  2. Where the features (geometric predicate): select intersect
  3. By comparing to the features from: the forest area layer
  4. Modify current selection by: select creating new selection
The Select by location dialog
The Select by location dialog

The grid cells that overlap forest areas are selected and highlighted in yellow.

Result of Select by location
Result of Select by location

With the cells still selected, open the attribute table, and then open the Field Calculator.

  1. Clear Only update selected features.
  2. Select Create a new field, and specify the field name, type, and length.
  3. Enter if( is_selected( ), 1, 0) as the expression.
The Field Calculator dialog. The expression writes 1 for selected features and 0 for the rest.
The Field Calculator dialog. The expression writes 1 for selected features and 0 for the rest.

The function is_selected( ) returns TRUE when a feature is selected. When you run the Field Calculator, the selected grid cells (those that overlap forest areas) get 1, and the other cells get 0.

Result of the Field Calculator. Values of 1 or 0 are filled in.
Result of the Field Calculator. Values of 1 or 0 are filled in.

Condition 3: prefers areas near water

For the third condition, “prefers areas near water,” a grid cell scores 1 if it is within 100 m of a river and 0 otherwise.

How grid cells near rivers are determined
How grid cells near rivers are determined

Following the same approach as before, select the grid cells within 100 m of a river with Select within distance.

  1. Select features from: the grid layer
  2. By comparing to the features from: the river layer
  3. Where the features are within: 100 meters
  4. Modify current selection by: select creating new selection
The Select within distance dialog
The Select within distance dialog

The grid cells within 100 m of a river are selected and highlighted in yellow.

Result of Select within distance
Result of Select within distance

With the cells still selected, open the attribute table, and then open the Field Calculator.

  1. Clear Only update selected features.
  2. Select Create a new field, and specify the field name, type, and length.
  3. Enter if( is_selected( ), 1, 0) as the expression.
The Field Calculator dialog. The expression writes 1 for selected features and 0 for the rest.
The Field Calculator dialog. The expression writes 1 for selected features and 0 for the rest.

When you run the Field Calculator, the selected grid cells (those within 100 m of a river) get 1, and the other cells get 0.

Result of the Field Calculator. Values of 1 or 0 are filled in.
Result of the Field Calculator. Values of 1 or 0 are filled in.

Calculate the total score

Add up the scores of the three conditions to get the habitat suitability result.

Open the Field Calculator from the attribute table of the grid layer.

  1. Select Create a new field, and specify the field name, type, and length.
  2. Build an expression that adds up the condition scores calculated above. Enter “dem” + “forest” + “river”.
The Field Calculator dialog. Enter an expression that adds up the score of each condition.
The Field Calculator dialog. Enter an expression that adds up the score of each condition.

When you run the Field Calculator, QGIS adds a column holding the sum of the three scores.

The total scores are filled in.
The total scores are filled in.

Finally, color the grid cells by total score. Areas with higher scores are more suitable habitat.

Coloring by total score makes the distribution of suitable habitat easy to see on the map (created over a GSI Tiles background)
Coloring by total score makes the distribution of suitable habitat easy to see on the map (created over a GSI Tiles background)

Conclusion

This article introduced a method for estimating suitable habitat for animals, plants, and other organisms with GIS.

The method applies not only to selecting suitable habitat but also to a wide range of other analyses, such as finding suitable sites for wind and solar power generation, assessing disaster risk, and planning new store locations.

This example used three conditions: elevation of 150 m or higher, presence of a forest area, and a distance of 100 m or less from a river. You can also try other environmental conditions, such as “1 point if a certain vegetation type covers at least ○ ha of the cell,” or “1 point if the slope angle is between ○ and ○ degrees, and 2 points if it is ○ degrees or more.”

About the author
QGIS LAB Editorial Team
QGIS LAB Editorial Team

QGIS LAB is a comprehensive information hub for QGIS, the open-source GIS software. Under the concept of “Geospatial for Greater Good,” we share the knowledge and skills to open up the world through location data.