I want to merge 2 raster files, but assigning the overlapped area to a specific one.

How could I do it?

1 Answer 1


The GRASS module r.patch does exactly what you want. All cells in the output map are filled with the first input, unless it is NULL, in which case the second input is used. So, set your computational region to cover both maps, then run r.patch:

g.region -p rast=map_a,map_b
r.patch input=map_a,map_b output=ab_mosaic

Take care that values of 0 in map_a will also be filled with map_b instead.

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.