From 80f6021f48cc9f9ca997c7f36df20d3465c967ee Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 13 Aug 2013 20:26:12 +0200 Subject: Use LZW compression, and increase the cache size to 512MB. --- mkindex.pl | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'mkindex.pl') 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; -- cgit v1.2.3