I have a QGIS project with several shapefiles like the one in following image. I want to know how many times the shapefiles overlap and where is produced a gradient.

I think the best option is to transform the polygons in a grid line 1km*1km with data presence/absence to produce the gradient. But I am not pretty sure if this is possible and how to do it.

enter image description here

  • Are you trying to symbolize where the polygons overlap with a gradient? – Alex Oct 30 '17 at 14:40
  • Which is your gradient definition? – xunilk Oct 30 '17 at 15:12
  • My gradient definition is the number of times that the polygons overlap(0,1,2,3). But since my polygons are very irregular I would like to show the results with a grid 1km*1km. I have the shapefile with the grid just don't know how to covert the data – Eduardo Oct 30 '17 at 15:51
  • 1
    That's a very 'raster' way of thinking - you want to create a raster with the overlap amount in the cell. Another way of getting a value on overlap would be to clip the two polygon layers and then sum the area of "clipped" result that falls within the larger polygon layer (you can keep some of the attributes in the clip and so a more detailed summation if that's helpful). You could also merge the two polygon layers and the new merged set will have the attributes of both. In all cases make sure they have the same CRS. – Geocurious Oct 30 '17 at 20:23
  • Okay I understood, thank you for the help. I already did my rasta file. – Eduardo Oct 30 '17 at 22:46

This is another approach using SAGA Polygon self-intersection tool, which can be accessed through QGIS Processing Tools | SAGA | Vector polygon tools | Polygn self-intersection. (I am not sure but this tool probably became available from QGIS 2.18.13).

enter image description here

The above image shows a sample polygon layer, in which nine polygons are partially overlapping each other. Currently I have one id field only.


  1. Activate Polygon self-intersection tool and select layer name and its identifier (id field). Just click on [Run] button.
  2. It will generate a new polygon layer named Intersection, which overlapping parts of polygons are divided into individual pieces. Open its attribute table.
  3. The attribute table will show a new field ID which is something like 2|1, 3|2, ... indicates overlapped ids. (Please also see the image below).
  4. Create new field with an expression length("ID") - length(replace("ID", '|', '')) + 1. This (my_counts in my test case) is the count how many polygons were overlapping at each location.

enter image description here

Above image is labeled by the overlapping counts. (Please note the polygons were separately colored by another field ($rownum), which I added afterwards).

enter image description here

Finally, please use this counts field to set your gradient color.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.