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 have about 600 GeoTIFF map files, each about 140 mb in size that I'd like to convert to KMZ files so people can download them and use them with Garmin GPS units, Google Earth, etc.

Anyone know an easy way to batch process these, preferably converting the tiff image to a much smaller jpeg image as part of the process?

I've stumbled upon gdal_translate which I guess might be useful optimising the images into something smaller using the "-co COMPRESS=JPEG" option.

share|improve this question
    
Looks like G-Raster might let me do the process file-by-file. –  Gavin Dec 29 '11 at 3:39
    
Global Mapper looks capable too, but is a bit expensive as I'm not going to be profiting from people downloading the KMZ files. –  Gavin Dec 29 '11 at 3:51
    
OkMap produces good output, but again lacks that useful batch processing option. –  Gavin Dec 29 '11 at 10:27
1  
if the images are that big you must not only tile them in maximum 1 megapixels, you also must not exceed 100 tiles within the same KMZ in order for Garmin handhelds to accept it as a custom map. It must also be in WGS84 lat long. See garmin forum for more details on Garmin KMZ support. –  Stefan Jan 10 '12 at 9:53
    
In the end I completed the process manually using OkMap. Thanks for everyone's input. –  Gavin Jan 10 '12 at 21:10

5 Answers 5

up vote 13 down vote accepted

Recent versions of gdal_translate have support for KML Superoverlay. Although it is not yet documented on the GDAL website the following can be used:

gdal_translate.exe -of KMLSUPEROVERLAY c:\in.tif c:\out.kmz -co FORMAT=JPEG

This will save a tiled version in a kmz file using jpeg compression.

On windows you can automate using

forfiles /m *.tif /c "cmd /c gdal_translate.exe -of KMLSUPEROVERLAY @FILE @FNAME.kmz -co FORMAT=JPEG"

This assumes that the input files are in WGS84.

share|improve this answer
    
Unfortunately I've just discovered that the KMZ's produced aren't Garmin Custom Map compatible KMZ files. –  Gavin Jul 16 at 9:29

I posted a python script to use from ArcGIS here:

Exporting 3GB ArcGIS Raster to KML without losing resolution?

The different models support different numbers of tiles. You have to look at this limitation, the extent of imagery you want to use, and the minimum resolution you want to use. Then you need to possibly create multiple files from your original imagery, process each section of imagery with the script tool, and transfer the files from a laptop to the GPS as you need them (Garmin only support 1 "Custom Map" at a time). Many of the *map models only support 100 1024x1024 tiles. The Colorado and Montana support more. I experimented with changing the tile size to 2048 x 2048 and that seemed to still work and allow for quite a bit more data at a time.

In your case I would mosaic to a few multi-Gig images and process these big area's of imagery and let users subset them in google earth and save out their own kmz from there. The Custom Maps thing is intentionally very limiting as Garmin would rather support their jnx format and sell you a Birdseye subscription.... Or force you to hack their devices.

share|improve this answer

Also there is a QGIS plugin to make .kmz files from your QGIS canvas for Garmin devices. It is called GarminCustomMap

share|improve this answer

I've never used images in KML, though it looks like gdal2tiles.py may help. Depending on the OS you can do the batch conversion in variety of ways. In Windows with CMD use command: DIR path > yourfile.txt (generate list of your files), import .txt in to Excel/OpenOffice, clean it and add your syntax for GDAL. Save as filename.bat and run it from command line.

share|improve this answer
    
I'm familiar and regularly use gdal2tiles but am a little unsure what settings I should use to spit out kmz. Any ideas? –  Gavin Dec 29 '11 at 10:18
1  
I guess it's just a case of zipping kml output and images then renaming zip file to kmz extension. –  Gavin Dec 29 '11 at 10:40
    
That's it. If you want to compress your images, you should have a look what kind of data type it is and maybe change it to something more memory efficient. –  Tomek Dec 29 '11 at 11:24
    
gdal2tiles is almost there but OkMap produces much more elegant results. Tile sizes are calculated by OkMap to split the original image efficiently, allowing rectangular tiles rather than square tiles so avoiding extra transparent areas. I wonder if I can somehow automate / command line OkMap to batch process my files. –  Gavin Dec 30 '11 at 0:36

If the Geotiff files are each 140 mb in size, the resulting jpg files might still quite big. It might be interesting to split the files into smaller files, so that they can be more easily displayed. You could try with one file using http://www.maptiler.org/ which has an option to generate a KML Superoverlay. MapTiler might not be appropriated to batch process all files, but it is easy to use so that it is good to make some preliminary tests.

If it works as you want, you can then try to batch process all files using GDAL2Tiles. I haven't try it, but I think it should be possible as MapTiler is based on GDAL2Tiles.

share|improve this answer
    
OkMap does this - takes the GeoTIFF and then splits it in to multiple smaller images for use in the KMZ file. gdal2tiles is a handy tool - just haven't figured out how to produce the kmz from it yet. Will play some more. –  Gavin Dec 29 '11 at 10:28
    
OkMap is new to me. It will have a look at it, it seems to be an interesting program. –  Name Dec 29 '11 at 12:23
    
gdal2tiles is almost there but OkMap produces much more elegant results. Tile sizes are calculated by OkMap to split the original image efficiently, allowing rectangular tiles rather than square tiles so avoiding extra transparent areas. I wonder if I can somehow automate / command line OkMap to batch process my files. –  Gavin Dec 30 '11 at 0:36

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.