[gdal-dev] Question about gdaladdo and raster mosaicking

Ammar ammar83_h at yahoo.com
Sun Jan 26 07:17:52 PST 2014


Brian,

Thank you for your help. I tried your suggestion and it gave me the same result. I started to believe that it is a lossy compression problem because once I tried to compress with LZW + predictor 2, the problem was gone!

Thanks again




________________________________
 From: Brian Case <rush at winkey.org>
To: Ammar <ammar83_h at yahoo.com> 
Cc: Etienne Tourigny <etourigny.dev at gmail.com>; gdal dev <gdal-dev at lists.osgeo.org> 
Sent: Thursday, January 23, 2014 6:11 PM
Subject: Re: [gdal-dev] Question about gdaladdo and raster mosaicking
 

Ammar


you want to turn on internal masks in the shell, gdaladdo will not use
them otherwise. also you will need to turn this on if you use mapserver.
gdal will need to have this turned on for any further operations.

gdaladdo should use the correct image options without specifying them

export GDAL_TIFF_INTERNAL_MASK=YES

gdalbuildvrt -srcnodata 255 -vrtnodata 255 -addalpha \
             -input_file_list tiff_list.txt \
             mosaic02.vrt


gdal_translate -of GTiff -b 1 -b 2 -b 3 -mask 4 -a_srs EPSG:3011 \
               -co TILED=yes -co photometric=ycbcr \
               -co compress=jpeg -co jpeg_quality=80 \
               -co blockxsize=512 -co blockysize=512 \
               -mosaic02.vrt \
               -mosaic02.tif

gdaladdo mosaic02.tif -r average 2 4 8 16 32 64 128 256 512



and you should end up with a 



On Thu, 2014-01-23 at 06:28 -0800, Ammar wrote:
> Etienne,
> 
> I tried the following:
> 
> gdalbuildvrt -srcnodata 255 -vrtnodata 255 -addalpha -input_file_list
> tiff_list.txt mosaic02.vrt
> 
> gdal_translate -of GTiff -b 1 -b 2 -b 3 -mask 4 -a_srs EPSG:3011 -co
> TILED=yes -co compress=jpeg -co jpeg_quality=80 -co blockxsize=512 -co
> blockysize=512 -co photometric=ycbcr --config gdal_tiff_internal_mask
> yes mosaic02.vrt mosaic02.tif
> 
> gdaladdo mosaic02.tif -r average --config COMPRESS_OVERVIEW JPEG
> --config JPEG_QUALITY_OVERVIEW 60 --config INTERLEAVE_OVERVIEW PIXEL
> --config PHOTOMETRIC_OVERVIEW YCBCR 2 4 8 16 32 64 128 256 512
> 
> Did I implement the mask the right way? The results I got were similar
> to the JPEG compression with no mask, in other words I got white lines
> too!
> 
> 
> 
> 
> 
> 
> 
> 
> ______________________________________________________________________
> From: Etienne Tourigny <etourigny.dev at gmail.com>
> To: Ammar <ammar83_h at yahoo.com> 
> Cc: Chaitanya kumar CH <chaitanya.ch at gmail.com>; gdal dev
> <gdal-dev at lists.osgeo.org> 
> Sent: Thursday, January 23, 2014 12:25 PM
> Subject: Re: [gdal-dev] Question about gdaladdo and raster mosaicking
> 
> 
> As was suggested, you could try using a mask instead.
> 
> 
> On Thu, Jan 23, 2014 at 7:52 AM, Ammar <ammar83_h at yahoo.com> wrote:
>         Chaitanya,
>        
>         Thank you very much for your reply and suggestion. I have used
>         LZW with predictor 2 compression and added external overviews
>         compressed in LZW too and the image came perfect. The only
>         downside is the size of each of the images has expanded from
>         approx. 2 GB to 18-20 GB. So now I have to choose between
>         quality and size!
>        
>         Attached are two screen shots showing the difference.
>        
>         Thanks again!
>        
>         Regards,
>         Ammar
>        
>        
>        
>        
>        
>        
>         ______________________________________________________________
>         From: Chaitanya kumar CH <chaitanya.ch at gmail.com>
>         To: ammar83_h at yahoo.com 
>         Cc: gdal dev <gdal-dev at lists.osgeo.org> 
>         Sent: Tuesday, January 21, 2014 6:27 PM
>         Subject: Re: Question about gdaladdo and raster mosaicking
>        
>        
>         Ammar,
>         You are using lossy JPEG compression. I'm guessing that the
>         white lines are are actually pixels with values near but not
>         equal to 255. So, they are not treated as nodata pixels.
>         My suggestion is to use another format with lossless
>         compression for the 21 images or use a mask band if you
>         prefer.
>         Let me know how it goes.
>         --
>         Best regards,
>         Chaitanya Kumar CH
>         On 21-Jan-2014 5:31 pm, <ammar83_h at yahoo.com> wrote:
>                 Hello Chaitanya,
>                
>                 I was looking online for solutions to my problem and I
>                 cam across some of your posts so I thought you might
>                 help me with my problem.
>                
>                 I have 10,000+ TIFF files that I want to merge into
>                 one big Image and serve using GeoServer. I merged
>                 every 500 images at a time creating using gdalbuildvrt
>                 and gdal_translate along with JPEG compression
>                 creating 21 TIFF files. I added overviews then to each
>                 of the new 21 files. When adding the images together,
>                 once directly as files using QGIS and another time as
>                 WMSs using GeoServer, I got white lines/gaps precisely
>                 at the border of ever 2 images. I thought the problem
>                 is with no data values but I decided to take another
>                 approach and merged all the 10,000 files into one huge
>                 image and this time I got one perfect image with no
>                 lines or gaps. I failed to create overviews for the
>                 big image because the process took days or gdaladdo
>                 running with no progress. I tested then on smaller
>                 images with and without overviews and the ones with no
>                 overview came perfect while the one with gdaladdo
>                 overviews came with the same problem of lines and
>                 gaps. The commands I m using are the following:
>                
>                  gdalbuildvrt -srcnodata 255 -vrtnodata 255 -a_srs
>                 EPSG:27700 -input_file_list tiff_list.txt mosaic.vrt
>                
>                 gdal_translate -of GTiff -co TILED=YES -co BIGTIFF=YES
>                 -co COMPRESS=JPEG -co JPEG_QUALITY=80 -co
>                 BLOCKXSIZE=512 -co BLOCKYSIZE=512 -co
>                 PHOTOMETRIC=YCBCR mosaic.vrt mosaic.tif
>                
>                 gdaladdo mosaic.tif -r average --config
>                 COMPRESS_OVERVIEW JPEG --config JPEG_QUALITY_OVERVIEW
>                 60 --config INTERLEAVE_OVERVIEW PIXEL --config
>                 PHOTOMETRIC_OVERVIEW YCBCR 2 4 8 16 32 64 128 256 512
>                
>                 Any ideas, tips or recommendations would be
>                 appreciated!
>                
>                 Best regards,
>                 Ammar
>                
>                 _____________________________________
>                 Sent from http://osgeo-org.1560.x6.nabble.com
>                
>        
>        
>        
>        
>         _______________________________________________
>         gdal-dev mailing list
>        gdal-dev at lists.osgeo.org
>        http://lists.osgeo.org/mailman/listinfo/gdal-dev

> 
> 
> 
> 
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140126/b1e6c035/attachment-0001.html>


More information about the gdal-dev mailing list