I have a TIFF file which is georeferenced in UTM coordinates.

So as a first step, I convert the UTM TIFF into a WGS84 TIFF using gdalwarp. On the next step, I used gdal_translate to convert a TIFF into a KMZ file but I have a problem with the "color" of the image. Here are the commands I used :

gdalwarp test_utm.tif -t_srs EPSG:4326 test_wgs84.tif
gdal_translate -a_nodata 0 -of KMLSUPEROVERLAY -co FORMAT=JPEG test_wgs84.tif test.kml

In fact, the image should be in greyscale (there is only 1 band on the TIFF) but here, the result is fully white with only the shadows which are gray/dark. I think there is a problem with the values of the KMZ ?

Here is a screenshot of the KMZ file : enter image description here

Here is the TIFF description of the WGS84 converted TIFF :

gdalinfo test_wgs84.tif 
Driver: GTiff/GeoTIFF
Files: test_wgs84.tif
Size is 8618, 6296
Coordinate System is:
        SPHEROID["WGS 84",6378137,298.257223563,
Origin = (-111.186216437919299,38.213784466217568)
Pixel Size = (0.000005191716045,-0.000005191716045)
Image Structure Metadata:
Corner Coordinates:
Upper Left  (-111.1862164,  38.2137845) (111d11'10.38"W, 38d12'49.62"N)
Lower Left  (-111.1862164,  38.1810974) (111d11'10.38"W, 38d10'51.95"N)
Upper Right (-111.1414742,  38.2137845) (111d 8'29.31"W, 38d12'49.62"N)
Lower Right (-111.1414742,  38.1810974) (111d 8'29.31"W, 38d10'51.95"N)
Center      (-111.1638453,  38.1974409) (111d 9'49.84"W, 38d11'50.79"N)
Band 1 Block=8618x1 Type=UInt16, ColorInterp=Gray
  NoData Value=0

Do you have any idea about why I have this problem ? I already convert other images with only 1 band also, and the output KMZ file was great (but I didn't process any conversion with gdal_warp, the tif was already in WGS84). I'm open in any free solution to convert an UTM TIFF into a KMZ file.

  • 2
    Your image is an 16 bit image and probably the histogram is biased. Run gdalinfo again with -stats and add min, max, mean and std values into your question. – user30184 Nov 14 '18 at 20:02
  • Might be a nodata issue. Please check if the original has a nodata value that got lost. – AndreJ Nov 15 '18 at 6:29
  • I just added the stats on my post, thank's for your answers – Lionel Nov 15 '18 at 8:29
  • If the values should be elevation, the minimum of 12 looks wrong for a landscape in Utah. Please check the stats of the UTM file. – AndreJ Nov 15 '18 at 13:09
  • It's an optical images so, no elevation values are stored on it. I just fixed now the problem by using the scale option on the gdal_translate command. I will put an answer with a lot more details to explain the pipeline used. – Lionel Nov 15 '18 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.