[gdal-dev] gdal_translate: set the CRS makes the output 10 times bigger

Even Rouault even.rouault at mines-paris.org
Thu Jun 2 14:07:21 EDT 2011


Le jeudi 02 juin 2011 20:00:15, Andrés Maneiro a écrit :
> Hello devs,
> 
> I'm playing with GDAL to set the CRS of a set of geotiff files I was
> given to upload them to geoserver later.
> 
> These files, were generated using ArcGIS and it seems that the CRS set
> in the geotiff file header is not standar (at least, my geoserver
> doesn't recognize them). What I did:
> 
>   gdal_translate -a_srs "EPSG:23029" original.tif output.tif
> 
> After doing that, the size of the output is 5/10 times bigger than input
> (in some cases: from 10Mb to almost 110Mb). The only thing I see as
> different -using gdalinfo on both files- is the "Color Table". The
> former has 2 entries and the output has 256. Don't know if it's the
> source of the problem, just let you know in case it is useful.

Hum, it's likely that your original.tif was compressed. gdal_translate without 
argument will generate an uncompressed file.

What is the output of gdalinfo on original.tif ? If you see a COMPRESS= 
metadata keywords, you can try reusing it as a creation option.

It is also likely that your original.tif is a 1bit file.

So, guess blindly, I would try :

gdal_translate -a_srs "EPSG:23029" original.tif output.tif -co NBITS=1 -co 
COMPRESS=PACKBITS

> 
> So, my question is: how could I generate an output file, with CRS set
> and with roughly the same size of the original?
> 
> best,
> amaneiro
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list