[GRASS-dev] More efficient to use r.mapcalc or r.patch in a l oop for creating mosaics?

Patton, Eric epatton at nrcan.gc.ca
Thu May 11 15:11:35 EDT 2006


Maciek,

My particular installation doesn't have gdal compiled with Grass support
(yet), so I need another work around, hence r.mapcalc/patch.

~ Eric.

-----Original Message-----
From: Maciek Sieczka
To: Patton, Eric
Cc: grassuser at grass.itc.it; grass-dev at grass.itc.it
Sent: 5/11/2006 2:52 PM
Subject: Re: [GRASS-dev] More efficient to use r.mapcalc or r.patch in a
loop for creating mosaics?

On Thu, 11 May 2006 14:16:32 -0300
"Patton, Eric" <epatton at nrcan.gc.ca> wrote:

> I'm writing a script to mosaic an arbitrary number of rasters
> together. So far, the script works fine, using the following mapcalc
> statement in a 'for' loop:
> 
> r.mapcalc "$OUTPUT=if(isnull(Map_A), Map_B, Map_A)"
> 
> I should note that I'm reading the map names in through an array
> which was populated in a previous step. My question is: Is there an
> advantage in using r.mapcalc over using r.patch for this work? At 1m
> resolution rasters, and about 60+ of them, this could take a long
> time.

How about GDAL?

gdal_translate to create an empty raster, of the target extents

write your maps into it with gdalwarp one by one

It should be faster than Grass.

There's also gdal_merge.py but it consumes lots of memory and may fail.

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie
tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/




More information about the grass-dev mailing list