Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to merge 60 geotiff files into one huge file in order to be able to product tiles from that resulting huge geotiff file by using gdal2tiles.

The merge process worked, but for some reason it produces a file that has a size of 78GB instead of the expected 19GB. Not quite sure what went wrong there.

The reason for trying that is because tiling the 60 geotiffs one by one gives me white spaces on the map border.

share|improve this question
add comment

3 Answers

Usually, GeoTIFFs are compressed for storage. Running gdal_merge on default settings won't compress the file. Add the option

-co COMPRESS=DEFLATE

(or any of the other options listed in the documentation) to your command to get smaller output files.

share|improve this answer
1  
For future reference - mine, if nobody else's - gdal.org/frmt_gtiff.html has the set of GeoTiff specific options that you should be able to use for any of the gdal commands. Depending on the type of imagery you have, you might want COMPRESS=LZQ or even JPEG; it'd be well worth the time to verify the type of compression used on the source images. –  Herb Sep 26 '10 at 1:42
    
Thanks Herb, I have updated the answer to contain your link. –  underdark Sep 26 '10 at 12:14
add comment

As underdark points out, the best solution is to compress your imagery to prevent the large volume of empty space being stored directly (the native TIFF image is like a bitmap: every value takes up the same amount of space). Another handy compression option is:

-co COMPRESS=LZW

It rarely has the same compression ratio as DEFLATE, but has the advantage of working with most software, where DEFLATE isn't supported in many environments such as ArcGIS 9.x.

You can try even more aggressive lossless compression by using one of the wavelet transformations, such as ECW, MrSID or one of the various JPEG2000 implementations. Keep in mind that you'll need tools using GDAL or otherwise implement the libraries to access the data in these formats.

share|improve this answer
add comment

You might avoid merging your geotiff files by writing a vrt file which merge them "virtually".

It is an XML file that describe how the files should be assembled. All gdal utilities accept this vrt file as an input map. gdal2tiles or MapTiler are both based on gdal so that they should be able to use a vrt file (I haven't try yet with a vrt file but I have already tried with a gdal_wms file and it worked pretty good).

Writing the vrt file from scratch is not easy. Simply convert one of your geotiff to vrt to have an example:

gdal_tranlate -of vrt one_of_your_geotiff.tif one_of_your_geotiff.vrt

There is also a tool called gdalbuildvrt but I didn't try it.

share|improve this answer
1  
Matt Perry has a nice writeup of some of the advantages of using VRTs here: perrygeo.net/wordpress/?p=141 –  scw Oct 26 '10 at 21:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.