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

Andrés Maneiro amaneiro at icarto.es
Thu Jun 2 14:32:33 EDT 2011


Ah, by the way, your suggestion generates an output 10 times shorter. 
Smart guess :) But I'd like to generate a file more or less equal than 
input to not loose quality.

Other thing that is weird for a newbie as me, is that the gdalinfo for 
the output tiff is the same (even Size parameter!) apart from having 
more entries in color table (all of them with the same color than 0 band 
in the original).

best,
amaneiro

On 02/06/11 20:07, Even Rouault wrote:
> 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