[GRASS-user] Add up several maps, which hold different regions, with mapcalc

Marcello Gorini gorini at gmail.com
Mon Jun 18 04:36:21 PDT 2012


Büro Seling said:


> My problem begins, when I now try to add up all these single maps into one
> larger map.
> I searched for a solution and tried several things, but nothing worked.
>
> Any tipps or hinds?
>


Hey,

As always, there is probably a much more elegant solution to this problem,
but this should get you going for now:

>  g.region
rast=map1,map2
# just to make sure your region encompass everything
> r.mapcalc
"bigmap=if(isnull(map1),99999,map1)+if(inull(map2),99999,map2)"       #
replace nulls on the fly by a specific value that your data does not contain
> r.mapcalc
"bigmap=if(bigmap==99999,null(),bigmap)"
# put back the nulls

Well, ugly like all my codes, but it works.

Cheers,
Marcello.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20120618/fa69e912/attachment.html>


More information about the grass-user mailing list