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

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.

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?

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.

Cheers,
Peter
--
View this message in context: http://n2.nabble.com/Advice-needed-quickest-way-to-create-a-mosaic-tp4731125p4731125.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On Sun, Mar 14, 2010 at 10:45 AM, geep999 <geep999@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 ------------------------
#!bin/sh

# mosaik DTM tiles

RES=5

OUTFILE=dtm_${RES}m_UTM_WGS84.tif
SHADED=`basename $OUTFILE .tif`
INDIR=/geodata2_originals_raid5/dem_tiles/
INPUT="$INDIR/dtm*.tif"

# GDAL_CACHEMAX --config GDAL_CACHEMAX 500 -wm 500
CACHE="--config GDAL_CACHEMAX 3000 -wm 3000"
gdalwarp $CACHE $INPUT $OUTFILE
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

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

Works well even on a portable computer...

Markus

geep999 wrote:
> Or is it more efficient to create strips, and then
> patch the strips together?

Markus wrote:

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

I believe it will be considerably faster. much less empty space
to search through.

Hamish