<div>That seemed to do the trick. It finished overnight, a lot faster than before.</div><div><br></div><div>Final file was 83GB. (Only 1/2 the dataset was used)</div><div><br></div><div>Is there a reason <span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">GDAL_CACHEMAX 2147 is the maximum? Under 64-bit a 32-bit process has 4GB of virtual memory rather than 2GB under 32-bit (or 3GB with the /3GB Windows boot switch).</span></div>


<div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><br></span></div><div><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">I was successfully able to use kdu_compress on the result as well so now I only need 4GB to store the file! (Although kdu_compress also has a memory limit at 2GB, but you can flush the codestream after every tile to fix that).</span></div>


<div><br clear="all">Thanks,<br>Leith Bade<br><a href="mailto:leith@leithalweapon.geek.nz" target="_blank">leith@leithalweapon.geek.nz</a><br><br>
<br><br><div class="gmail_quote">On 17 July 2010 15:29, Greg Coats <span dir="ltr">&lt;<a href="mailto:gregcoats@mac.com" target="_blank">gregcoats@mac.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div style="word-wrap:break-word"><div>Since you have 4 GB RAM, I suggest overriding the 40 MB GDAL_CACHEMAX default, and increasing it</div><div>gdal_merge.py --config GDAL_CACHEMAX 1000 </div><div>The maximum possible GDAL_CACHEMAX is</div>


<div>gdal_merge.py --config GDAL_CACHEMAX 2147</div><div>Greg</div><font color="#888888"><div><br></div></font><div><div><div>On Jul 16, 2010, at 9:19 PM, Leith Bade wrote:</div><br></div><blockquote type="cite">
<div><div></div><div>Hi,<div><br></div><div>I am trying to use gdal_merge to mosaic a very large topo GeoTIFF set.</div><div><br></div><div>Uncompressed the data set is 60GB, but I keep it stored with DEFLATE compression which results in a dataset under 10GB.</div>




<div><br></div><div>Mosaicked the uncompressed file will be 125GB because of the large regions of nodata generated. Unfortunately this is too big to store on my HDD so I need to apply DEFLATE to it as well.</div><div><br>




</div><div>I am experimenting with only 1/2 the data set at the moment with this command:</div><div>gdal_merge -co COMPRESS=DEFLATE -co ZLEVEL=9 -co BIGTIFF=YES -o NI-50.tif *-00.tif</div><div><br></div><div>On my AMD Phenom II X4 @ 3.2GHz, 64 bit Windows 7, 4GB DDR3 CAS-7 RAM (basically a decently specced PC gaming machine)</div>




<div>it has been running for 16 hours and so far has only made it 60% (124 of 204 files)</div><div><br></div><div>The other issue is so far the file is 54GB so I will likely run out of disc space before it finished. This indicates that no DEFLATE compression is happening at all!</div>




<div><br></div><div>It currently maxing only 1 CPU core, so I assume it is trying to run DEFLATE then somehow failing to compress at all?</div><div><br></div><div>Looking at gdal_merge.py I think the major performance issue is the order in which it copies the data. Currently it copies an entire image at a time (1 colour channel at a time). Thus DEFLATE will not work due to the rather random write pattern to each scanline.</div>




<div><br></div><div>I think a much faster method would be to calculate the destination rectangles for each file into some sort of list. Aftter this generate the destination file 1 scanline at a time, calculating which source images intersect, and working left to right filling with solid color or copying scanlines from the source image.</div>




<div><br></div><div>This allows the DEFLATE to work far more effciently as the write pattern is horizontally linear.</div><div><br></div><div>What are your views/suggestions/etc.?</div><div><br clear="all">Thanks,<br>Leith Bade<br>




<a href="mailto:leith@leithalweapon.geek.nz" target="_blank">leith@leithalweapon.geek.nz</a><br><br>
</div></div></div><div>
_______________________________________________<br>gdal-dev mailing list<br><a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></div>


</blockquote></div><br></div>
<br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br></div>