Using r.series with the aggregate minimum option I'm merging multiple viewshed results to visualize how much vertical space a development area has for new buildings. Meaning that a part of the height limitation comes from raster1.tif while the height limitations for another part of the area could come from raster2.tif etc.

enter image description here

Currently I'm classifying the merged results for every 4th meter and coloring it different color so that the reader can understand how much space there is left. This is a working product that fills it's purpose, BUT:

My question is if it's possible to create a compliment map that doesn't care about the actual raster values but rather visualizes the origin of the merged results? Or put in other words: can I style the raster so that values extracted from raster1.tif gets one color and values from raster2.tif another color?

I've been elaborating with a merge that stacks the input layers in different bands but haven't been able to set the color for more than three bands simultaneously, and also the aggregate minimum function is also missing in this attempted solution.

I'm currently using QGIS but also have access to FME, Arc, Mapinfo and PostGIS.

  • How would you like to handle overlapping raster areas in your final product? Also, do you work with R?
    – Aaron
    Feb 27, 2018 at 4:11
  • Should be a comment but I do not have enough reputation to put it there, sorry moderators: Is there a reason you are not allowed/ do not want to merge the height information from the separate rasters into one raster? In the end, it is one information layer ('height limitations').
    – gannebamm
    Feb 27, 2018 at 11:01
  • The map shown above is a product of 50 rasters with the same extent so all rasters always overlap (I've run viewshed analysis from 558 different observerpoints with a radius that covers the whole city of Stockholm). The merge is done with r.series keeping only the minimum value for each pixel. This is a working product. Now I'm trying to create a supplement product that shows the origin from where (which raster layer) the r.series aggregate minimum-job actually took the lowest value from (and that's what I'm trying to visualize by adding three different colors and text to the above map).
    – johlund
    Feb 27, 2018 at 11:17
  • I'm not currently using R but I'm open to suggestions if it does the job!
    – johlund
    Feb 27, 2018 at 11:17

1 Answer 1


I've not tried this, but according to the GRASS 6 documentation for r.series there's an option for the method parameter called min_raster. This also seems to be available in GRASS 7 although the docs only list it as an option.

min_raster: raster map number with the minimum time-series value

Likewise for max_raster. It only works with min/max stats (which makes sense).

Also, from this page

The min_raster and max_raster methods generate a map with the number of the raster map that holds the minimum/maximum value of the time-series. The numbering starts at 0 up to n for the first and the last raster listed in input=, respectively.

Although it mentions time series, I think this might work for your particular case given you're looking for the raster number with the minimum value for each cell.

  • This is definitely interesting Steven! I'll try when I have the chance - funny that I've always wondered what the min/max_raster-function in r.series was about.. My result rasters are named 1-558.tif, but I'm aggregating them to around 35 merged rasters where for example 1-52 goes to the first merged results and 53-61 to the second and so on. So there will be a challenge to translate the min_raster results for all but the first merge since my file numbering continues up to 558, while the min_raster results starts over from zero for every merge.
    – johlund
    Feb 28, 2018 at 5:27
  • This worked perfect for my particular case Steven, but like I suspected keeping track of which layer took some manual thinking. Thanks a lot!
    – johlund
    Mar 15, 2018 at 13:10

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.