summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmkindex.pl14
1 files 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 I<map>s 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->{$_}) }