[GRASS-user] Advice needed - quickest way to create a mosaic

Markus Neteler neteler at osgeo.org
Mon Mar 15 07:13:49 EDT 2010

On Sun, Mar 14, 2010 at 10:45 AM, geep999 <geep999 at yahoo.co.uk> wrote:
> Hi,
> I need some advice on the quickest way to create a mosaic.
> I have sucessfully used the example from the r.patch manual page:
> MAPS=`g.mlist type=rast sep=, pat="map_*"`
> g.region rast=$MAPS
> r.patch in=$MAPS out=mosaic
> I have 115 1 degree ASTER tiles that I want to mosaic together before
> re-projecting with r.proj.
> My 1st attempt was to run r.patch with a list of all 115 tiles.
> It didn't seem to progress - the progress stuck at 0% for about 5 minutes. I
> killed the process.

To tile 115 maps needs WAY more that 5 minutes, maybe a few days depending
on the map size, computer speed, RAM etc.

I am used to wait days to obtain (large) mosaiks, using gdalwarp.

> My 2nd attempt was to create strips for each degree of latitude and then
> patch the strips together.
> There are about 10 tiles in each strip. Each strip took a few minutes.
> Patching the 14 strips together took more than 1 hour (2.3GHz Intel Dual
> Core + 4Gb RAM).
> Should I have waited for my 1st attempt to finish?
> Or is it more efficient to create strips, and then patch the strips
> together?

Sincerely, I have no idea if working in chunks is faster.

> Is there another faster method?
> I have tried using gdalwarp, but with large areas it eats up all my RAM,
> starts swapping and effectively hangs the machine.

I usually use gdalwarp for mosaiking like this:

------- snip ------------------------

# mosaik DTM tiles


SHADED=`basename $OUTFILE .tif`

# GDAL_CACHEMAX  --config GDAL_CACHEMAX 500 -wm 500
CACHE="--config GDAL_CACHEMAX 3000 -wm 3000"
mv $OUTFILE dtm.tmp
gdal_translate -a_srs utm32N.prj dtm.tmp  $OUTFILE
rm -f dtm.tmp
gdaladdo $OUTFILE 2 4 8 16 32 64

# gdaldem hillshade
gdaldem hillshade $OUTFILE ${SHADED}_shaded.tif
gdaladdo ${SHADED}_shaded.tif 2 4 8 16 32 64

echo "Generated $OUTFILE"
------- snap ------------------------

Works well even on a portable computer...


More information about the grass-user mailing list