TransWikia.com

Decompress a LZW-compressed GeoTIFF

Geographic Information Systems Asked by Nizzi on October 26, 2020

I have a LZW-compressed GeoTIFF file and would like to split it into several smaller regional files and change the format to png. I tried to do the spliting with gdal_translate -srcwin. I only get a black image. I guess that I first have to deal with the LZW-compression, but I cannot find a way to decompress files.

To compress the file I have the option -co COMPRESS=LZW. But how do I go the other way around. I am very much looking forward to your answers! 🙂

Here is the command I used:

$ gdal_translate -ot UInt16 -srcwin 6500 3300 1000 1000 input.tif output.tif

$ gdal_translate -of PNG -scale output.tif output.png

This is what gdalinfo says:

$ gdalinfo input.tif
Driver: GTiff/GeoTIFF
Files: EUD_CP-DEMS_2500035000-AA.tif
Size is 40000, 40000
Coordinate System is:
PROJCS["ETRS89 / ETRS-LAEA",
    GEOGCS["ETRS89",
        DATUM["European_Terrestrial_Reference_System_1989",
            SPHEROID["GRS 1980",6378137,298.2572221000027,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6258"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4258"]],
    PROJECTION["Lambert_Azimuthal_Equal_Area"],
    PARAMETER["latitude_of_center",52],
    PARAMETER["longitude_of_center",10], 
    PARAMETER["false_easting",4321000],
    PARAMETER["false_northing",3210000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3035"]]
Origin = (2000000.000000000000000,4000000.000000000000000)
Pixel Size = (25.000000000000000,-25.000000000000000)
Metadata:
  TIFFTAG_DOCUMENTNAME=EUD_CP-DEMS_2500035000-AA.tif
  TIFFTAG_IMAGEDESCRIPTION=File written by egcs_wrgtif 2.1
  TIFFTAG_SOFTWARE=IDL 8.2, Exelis Visual Information Solutions, Inc.
  TIFFTAG_DATETIME=2013:09:17 18:46:37
  TIFFTAG_XRESOLUTION=100
  TIFFTAG_YRESOLUTION=100
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( 2000000.000, 4000000.000) ( 26d54'5.12"W, 53d35'57.62"N)
Lower Left  ( 2000000.000, 3000000.000) ( 20d45'24.21"W, 45d41'42.74"N)
Upper Right ( 3000000.000, 4000000.000) ( 12d15'58.58"W, 57d13'49.19"N)
Lower Right ( 3000000.000, 3000000.000) (  8d 7'39.52"W, 48d38'23.47"N)
Center      ( 2500000.000, 3500000.000) ( 16d56'50.88"W, 51d31'45.31"N)
Band 1 Block=40000x1 Type=Float32, ColorInterp=Gray

One Answer

I found this question because I had the same need. Since there's no answer and I was able to make this work I've decided to post in case anyone else stumbles upon this.

The solution is pretty simple, that is, if you have GDAL installed. Using the gdal_translate application, one can decompress a GeoTIFF file using the following command:

gdal_translate pathtoinput.tif pathforoutput.tif -co COMPRESS=NONE

Answered by CodeJunkie on October 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP