Using QGIS I want to create maps which visualise the fire history of an area, in particular the time since the last fire. I have a shapefile which contains polygons of each fire that has occurred in the past ~60 years. Each fire is a unique polygon with a unique feature. Some fires overlap, partially or totally. How do I calculate the time since the last fire (from 2023) for every patch of fire?

To do this I will need to be able to identify the most recent burnt area at any location, and then subtracting the fire year that from the current year. Identifying the most recent fire might will not be as simple as selecting whole polygons, as some polygons will have smaller fires on top that are more recent. For example in the picture below: If the orange fire (circle) occurred in 2020, and then the blue diamond fire occurred on top of that area in 2022, the area covered by orange time since fire would = 3, where as the area covered by the blue would have a time since fire of 1.

enter image description here

The image below shows the fire history shapefile with labels for the various years of fire (some of which the polygons are hidden beneath the top layered polygon)


  • This might help gis.stackexchange.com/questions/62949/… - perhaps you could use the model builder docs.qgis.org/3.28/en/docs/user_manual/processing/modeler.html to iterate from most recent to the most historic, export polygons to a by year shapefile then use that to erase the older layer and finaly cumulate the by year shapefiles. That should give you a planar dataset. I used the same approach to flatten orthophotography coverage polygons to create an index of 'most recent' imagery. Sep 6, 2023 at 7:12
  • 2
    Wouldn't it work to just set the shapefile Style to control feature rendering order based on your date field, and use a colour ramp based on date. See gis.stackexchange.com/questions/183048/…. Most recent fires would be on top in any case, with a different colour than any potential underlying older fire.
    – Kasper
    Sep 6, 2023 at 9:13

1 Answer 1


I have polygon layer with a column named year depicting the year of the fire.


enter image description here

  1. Union the layer with itself as Input Layer, no Overlay layer: enter image description here

This will create duplicate geometries where multiple fires overlap.

  1. Aggregate and keep the "maximum" year per duplicate geometry: enter image description here
  2. Field Calculate years since fire: enter image description here

enter image description here

  • 1
    Thanks so much for the detailed instructions. A problem is when I try run the union function I get an error "Feature could not be written to Union_d832b3e3_7d92_43ae_ad51_bf0c3a83bb85: Could not add feature with geometry type MultiLineString to layer of type MultiPolygon Could not write feature Execution failed after 6.65 seconds" This is probably a separate issue, but I can't work out a fix. I've checked the geometry is valid, checked it's Polygon (MultiPolygon) geometry.
    – Amy
    Sep 7, 2023 at 6:26
  • A very annoying error, I also get it sometimes with Union. Try Snap points to grid and/or Buffering with a very small distance to nudge/change your geometries slightly. Then Union
    – BERA
    Sep 7, 2023 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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