From aa2d91c84d85b6ee9cd450e90614cecb7642c624 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 13 Aug 2013 20:46:38 +0200 Subject: Note on VRT creation prior to the call to mkindex.pl. --- mkindex.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mkindex.pl b/mkindex.pl index 7d670d6..50212bc 100755 --- a/mkindex.pl +++ b/mkindex.pl @@ -39,7 +39,12 @@ Merge all given Is into an index file, and annotate this index with tile borders and names. If required, each map is first expanded into RGBA, to get a decent -resampling. +resampling. This expansion can take a significant amount of space. An +alternative, much slower but which require nearly no extra space, is to +create expanded VRTs: + + for x in *.tif; do gdal_translate -expand rgba -of VRT $x ${x%.tif}.vrt; done + mkindex.pl *.vrt index.png =head1 OPTIONS @@ -369,7 +374,7 @@ sub tempfile { return $name; } -# Expand a dataset to RGBA. This code is mostly a perl translation of pct2rgb(1). +# Expand a dataset to RGBA. This code is nearly a perl clone of pct2rgb(1). sub expand_rgba { my $map = shift; @@ -444,6 +449,10 @@ sub merge { &debug("Wrapping into file '$dst_filename'..."); my @opts; + # We use the optimisations suggested below + # http://lists.osgeo.org/pipermail/gdal-dev/2009-August/021715.html + # http://trac.osgeo.org/gdal/wiki/UserDocs/GdalWarp + # '-multi' seems to slow down gdalwarp, though :-( push @opts, '--config', 'GDAL_CACHEMAX', $config{wm}, '-wm', $config{wm} if $config{wm}; push @opts, '-s_srs', $config{s_srs}->ExportToProj4() if $config{s_srs}; @@ -452,6 +461,7 @@ sub merge { push @opts, '-ts', $config{outsize}->[0], $config{outsize}->[1]; push @opts, '-q' unless $config{progress}; my $driver_opts = $driver_opts; + # gdalwarp cannot create properly compressed output # http://trac.osgeo.org/gdal/wiki/UserDocs/GdalWarp#GeoTIFFoutput-coCOMPRESSisbroken delete $driver_opts->{COMPRESS} if $driver_opts->{COMPRESS}; push @opts, '-of', $driver, map { ('-co', $_.'='.$driver_opts->{$_}) } -- cgit v1.2.3