2

I have one shapefile of Brazilian states (black lines) and another shapefile of Brazilian biomes (colored areas).

Brazilian biomes/states

I want to add, on the states' attribute table, the percentage of each state's area occupied by each biome. The table would become something like this:

  State.Name    Amazon  Cerrado  Caatinga  Atlantic.Forest ...
Amazonas           100        0         0                0
Tocantins           10       90         0                0
Minas Gerais         0       50        10               40
Rio de Janeiro       0        0         0              100
...

The names of the biomes would come from a field in the biomes shapefile.

I have found methods for single polygons (not for a table with dozens, or thousands, if done for municipalities -- which is my actual goal). Also found a method to calculate the area if the biomes were a raster, but here they are a vector, and I'd rather not rasterize it. Found a Python script too, but I don't dominate that language, and I think this should be simpler than that.

How can I do that in QGIS?

Rodrigo
  • 782
  • 5
  • 20
  • 1
    Intersects, Statistics by category, Field Calculator etc. What have you tried – BERA Oct 17 '20 at 08:34
  • @BERA What kind of intersect would give me such measures? Statistics by category don't mix different shapefiles. I have no idea which function on the Field Calculator could help me here, do you? I've tried the Overlap analysis, but it measures the overlap over the whole layer, not over each feature/biome, so each state end up with 100%, instead of different values in 6 columns. – Rodrigo Oct 17 '20 at 12:57
  • @BERA The Overlap analysis worked, I just needed to separate the biomes into different shapefiles. – Rodrigo Oct 17 '20 at 13:06
  • 2
    Hello Rodrigo, a small off-topic detail (not sure if you are aware): the dataset you are using is outdated. IBGE launched an updated biome dataset in 2019. Maybe it is part of your analysis, using the old one (but commenting anyway in case this is useful/relevant to you). Best. – Andre Silva Jan 05 '21 at 21:22
  • 1
    @AndreSilva Valeu, Andre! – Rodrigo Jan 05 '21 at 22:03

1 Answers1

4

This older post might be useful for you: Calculating percentage of overlap of two layers in QGIS 3

See the answer of @etrimaille. You can use the Overlap analysis which is included since QGIS 3.8. This tool calculates the overlap in area and percentage by which an input layer overlaps an overlay.

Just separate the biomes into different layers (one shapefile per biome), add all these layers into the analysis, and the resulting shapefile will have all the requested columns (both as area and percentage).

Source: https://changelog.qgis.org/en/qgis/version/3.8/#overlap-analysis

Rodrigo
  • 782
  • 5
  • 20
MarcM
  • 1,156
  • 4
  • 19
  • Right, it works. I needed to separate the biomes into 6 different shapefiles. Then the resulting shapefile has exactly the data I need. Thank you! – Rodrigo Oct 17 '20 at 13:04
  • Good to hear. I was not sure if that was needed, but glad it worked out – MarcM Oct 18 '20 at 14:31