Converting a class raster to a fuzzy raster in QGIS



In some cases, the data is not continuous (altitude, slope, distance, etc.), but discrete, i.e., consisting of classes.

Each pixel then corresponds to a category: a soil type, land use, risk level, etc.

These “categorical” rasters are very common in spatial analysis, but they pose a problem:

how can they be integrated into a fuzzy multi-criteria analysis when they do not contain continuous numerical values?

This is where the Classes → Fuzzy module of the FuzzyAttributes plugin (version 2) comes in.


The principle

Rather than working directly with classes (1, 2, 3… or “forest,” “urban,” “water”), we seek to express for each of them the extent to which it satisfies a given criterion.

Examples:

  • For a criterion of “areas favorable to infiltration,”

    • sandy soils → satisfaction 0.9
    • clay soils → satisfaction 0.3

  • urban areas → satisfaction 0.1
  • For a criterion such as “erosion risk,”

    • steep slopes → 0.8
    • forests → 0.2

The result is a fuzzy raster, in which each pixel takes a value between 0 and 1 representing the degree of satisfaction of the criterion.


Steps in the FuzzyAttributes plugin

  1. Menu: Classes → Fuzzy
  2. Select a categorical raster (single band, integer type).
  3. The plugin reads the unique values present in the layer.
  4. For each class, enter the fuzzy membership degree (between 0 and 1).
    You can also load a correspondence table from an existing CSV file.
  5. Choose a name for the output fuzzy raster (e.g., fzy_classes.tif).
  6. Click Create fuzzy raster.


Best practices

  • Consistency depends on the criterion studied: the same class may be favorable in one analysis and unfavorable in another.
  • Avoid absolute values of 0 and 1 unless you are completely certain: fuzzy logic allows you to express nuances.
  • Document your correspondences: they can be saved in a CSV file or a GeoPackage table for reuse.


A concrete example

Objective:

Create a suitability map for installing beehives based on the CORINE Land Cover raster.

Principle:

Each type of land use (forest, grassland, agricultural area, urban area, etc.) is assigned a satisfaction rating between 0 and 1 according to its suitability for beekeeping.


Step 1: Data source

You can download the CLC raster directly here:

https://land.copernicus.eu/pan-european/corine-land-cover/clc2018

Available formats: GeoTIFF, 100 m resolution.

You can then crop it to your study area (e.g., Corsica).


Step 2: Class correspondence

Here is an example correspondence table for bee assessment:

CLC code Simplified description Degree of suitability for bees (μ) Justification
111–142 Urban/artificial areas 0.1 Very low, few natural floral resources
211–244 Agricultural areas (crops, agricultural mosaics) 0.6 Presence of meadows and possible honey crops
311–313 Forests (deciduous, coniferous, mixed 0.8 Rich in honey species depending on the season
321–324 Natural vegetation (scrub, maquis, etc.) 0.9 Very favorable, widespread flowering, few disturbances
331–335 Open spaces, beaches, rocky areas 0.3 Few flowers, difficult conditions
411–423 Wetlands 0.4 Unstable environments, sometimes rich but fragile
511–523 Water bodies/sea 0.0 Obviously not favorable


Step 3: Fuzzy transformation

Using the FuzzyAttributes plugin → Classes module → Fuzzy:

1-Load the CLC raster (reclassified or original).

L’attribut alt de cette image est vide, son nom de fichier est fzy_exemple_raster_in-1024x774.jpg.

2-Define the correspondence table above (codes and μ).

L’attribut alt de cette image est vide, son nom de fichier est fzy_exemple_class-967x1024.jpg.

3-Generate the fuzzy raster fzy_corine.tif.

4-View: favorable areas (μ close to 1) will appear lighter.

L’attribut alt de cette image est vide, son nom de fichier est fzy_exemple_raster_out-1024x852.jpg.


Step 4: Interpretation

  • This produces a continuous map of suitability for beekeeping, rather than a patchwork of rigid classes.
  • It can then be combined with other fuzzy criteria:

    • proximity to water (need for watering)
    • altitude/slope
    • distance to roads (accessibility)
    • absence of treated crops

A fuzzy aggregation of these criteria will produce a multi-criteria map of optimal hive locations.


In summary

Transforming a raster of classes into a fuzzy raster means moving from a “categorical” logic to a ‘gradual’ logic—we move away from “all or nothing” to represent the degree of relevance of each class to an objective.


Si cet article vous a intéressé et que vous pensez qu'il pourrait bénéficier à d'autres personnes, n'hésitez pas à le partager sur vos réseaux sociaux en utilisant les boutons ci-dessous. Votre partage est apprécié !

Leave a Reply

Your email address will not be published. Required fields are marked *