summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2013-08-13 20:26:12 +0200
committerGuilhem Moulin <guilhem@fripost.org>2013-08-13 20:26:12 +0200
commit80f6021f48cc9f9ca997c7f36df20d3465c967ee (patch)
treee74bc4fa8d041ab47999523be5e5b354fb454249
parent9292447abd2eaeda9e82457f2d71d6a3caa92314 (diff)
Use LZW compression, and increase the cache size to 512MB.
-rwxr-xr-xmkindex.pl23
1 files changed, 14 insertions, 9 deletions
diff --git a/mkindex.pl b/mkindex.pl
index f56f8e3..64600fb 100755
--- a/mkindex.pl
+++ b/mkindex.pl
@@ -199,8 +199,12 @@ my %config = ( progress => sub {
, bordercolor=> 'red'
, fontsize => 25
, font => 'Helvetica'
+ , wm => 512
);
-
+my $gdal_opts = { INTERLEAVE => 'BAND'
+ , TILED => 'YES'
+ , COMPRESS => 'LZW'
+ };
GetOptions( "q|quiet" => sub { delete $config{progress} }
, "d|debug" => \$config{debug}
@@ -305,19 +309,15 @@ my $tmpdir = File::Temp::tempdir( CLEANUP => 1 );
# Ensure the existence of the internal driver.
my $driver = 'GTiff';
-my $driver_opts = { INTERLEAVE => 'BAND'
- , TILED => 'YES'
- , COMPRESS => 'NONE'
- , BIGTIFF => 'IF_NEEDED'
- , PROFILE => 'BASELINE'
- , TFW => 'YES'
- };
+my $driver_opts = { BIGTIFF => 'IF_NEEDED' };
my $driver_type = 'Byte';
die "Error: Unknown driver: '$driver'.\n"
unless Geo::GDAL::GetDriverByName($driver);
+$driver_opts->{$_} //= $gdal_opts->{$_} for (keys %$gdal_opts);
map &expand_rgba($_), @mapset;
-&annotate( &merge(), $index );
+my $mosaic = &merge();
+&annotate( $mosaic );
#######################################################################
@@ -411,11 +411,16 @@ sub merge {
&debug("Wrapping into file '$dst_filename'...");
my @opts;
+ 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};
push @opts, '-t_srs', $config{t_srs}->ExportToProj4() if $config{t_srs};
push @opts, '-r', $config{resampling} if $config{resampling};
push @opts, '-ts', $config{outsize}->[0], $config{outsize}->[1];
push @opts, '-q' unless $config{progress};
+ my $driver_opts = $driver_opts;
+ # 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->{$_}) }
(keys %$driver_opts);
my @src_filenames = map {$_->{filename}} @mapset;