diff options
-rwxr-xr-x | mkindex.pl | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -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; |