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