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

Paulo van Breugel p.vanbreugel at gmail.com
Mon Jun 18 04:54:22 PDT 2012


First set the region to fit all maps, like suggested by Marcello. Then, 
use r.patch to combine the maps.

Cheers,

Paulo



On 06/18/2012 01:36 PM, Marcello Gorini wrote:
> 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.
>
>
>
>
>
> This body part will be downloaded on demand.

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


More information about the grass-user mailing list