4

I have several polygons drawn in Google Earth, saved as .kml files. They represent the same feature (a lava flow) as identified by different people on satellite images (so one polygon = one person). My goal is to build a map as this one, where the color represents the number of overlapping polygons, here from 0 to 6:

enter image description here

I've done this with Matlab, by "rasterizing" (using the inpolygon function and a meshgrid). The problem is that I lose the vector information. For instance, I can't calculate the area of the polygon where the 6 flows overlap (I can sum all the pixels with the same value, but this is imprecise because of the pixel size). Plus I get some distortion due to the shift in coordinate system.

I figured I'd better do it with QGIS but this is where I get stuck. I managed to load the polygons, and that's pretty much it... I think I should use a geoprocessing tool like intersect but it takes only two layers as input. Is there any way to do this?

  • if you're able to use postgis this link should be helpful – Snaileater Apr 01 '20 at 14:35
  • if not, you could merge them together into 1 layer and use this algorithm to count the overlap: https://docs.qgis.org/3.10/en/docs/user_manual/processing_algs/qgis/vectoroverlay.html#union – PieterB Apr 01 '20 at 14:46

1 Answers1

4

A quick possibility (if all your objects lie in the same layer...) :

In the processing Toolbox, under SAGA, you have a treatment called polygon self-intersection which seems to be what you're seeking ...

(as a result, i seem to recall you will have a new field aggregating the id of all the polygons intersecting, so as a second step you will just have to base your symbology on the number of aggregated id's ...)

Snaileater
  • 5,743
  • 1
  • 15
  • 26
  • Yes, it's exactly what I was looking for, thanks! It does create a new field ID with values like '1|4|5', so I created a new field with the expression round(length(ID)/2) in order to get my categories. Now all I have left is to sum the areas of all polygons with the same number of overlap, which should be easy. – Jean-Marie Prival Apr 01 '20 at 15:31
  • I would like to do this too, but don't know my way around QGIS. Can someone explain step-by-step what to do (for simple example of two kml files)? – Sam Sep 27 '21 at 14:54