9

I am trying to merge two partially overlapping rasters into a single raster. Where they overlap, I would like to take the maximum value from the 2 rasters.

The rasters represent radio coverage from two different base stations.

I cannot find any way to do this and all similar questions appear to be unanswered. I can merge or add but cannot retain the maximum in the overlapping areas.

1
  • Please include links to any similar questions that you found to be unanswered so that we can address any duplicates that you are implying may be be present on this site.
    – PolyGeo
    Commented Nov 12 at 21:01

3 Answers 3

9

I recently discovered the GRASS tool r.series in the QGIS toolbox. If you set the Aggregate operation to Maximum it will give you the pixel that has the highest value. It works even if the extent of the 2 layers do not match and if the pixel size is different but will not work if the CRS's are different.

0
1

I would do this calculation on the SAGA raster calculator on QGIS, using an ifelse clause:

ifelse(gt(a,b), a, b)

which means: if a is greater than b, then output value a, if this condition is not true, output value from b. This is, therefore, the maximum value.

Observation: I believe that, prior to this calculation, the rasters should be on the same grid. If they are not, it is possible to adjust them by picking a pixel size value and an extent, preferentially the pixel size should be small enough that the information in both rasters is kept, and resample both rasters using Warp (reproject) tool.

0
0

Follow these steps:

1. Merge all your input rasters. The output (call it "step1_merged") will have the wrong values where the rasters overlaps, but it will overlap all the rasters you have and will enable you to use other qgis tools.

2. Use "Cell Statistics" and get the "maximum" value among all rasters (including "step1_merged"). Just make sure you use "step1_merged" raster as the reference layer for the output.

3. delete the temporary "step1_merged" raster

One problem with this solution might be lack of memmory if you are working with large rasters, since you need to create a temporary raster file in step 1.

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.