[Gdal-dev] gdalwarp HFA color problem

Markus Neteler neteler at itc.it
Tue Oct 26 07:27:24 EDT 2004


Hi,

when using 'gdalwarp' on a HFA image with a large
color table, the resulting file get's a corrupted
colot tbale (almost white):

gdalinfo hanoi_lsat7_brovey_UTM48N.img | grep   'Color Table'
  Color Table (RGB with 32764 entries)

gdalwarp -of HFA -t_srs '+init=epsg:4326'  hanoi_lsat7_brovey_UTM48N.img hanoi_lsat7_brovey_LL.img
Creating output file is that 9404P x 5964L.
:0...10...20...30...40...50...60...70...80...90...100 - done.

gdalinfo hanoi_lsat7_brovey_LL.img
...
Band 1 Block=64x64 Type=Int16, ColorInterp=Palette
  Color Table (RGB with 256 entries)
    0: 0,0,0,255
    1: 6,0,0,255
    2: 14,0,0,255
...
  254: 246,57,0,255
  255: 255,57,0,255

Is there a trick to avoid this problem?

When writing to GeoTIFF instead, it segfaults:
gdalwarp  -t_srs '+init=epsg:4326'  hanoi_lsat7_brovey_UTM48N.img hanoi_lsat7_brovey_LL.tif
Creating output file is that 9404P x 5964L.
Segmentation fault

Program received signal SIGSEGV, Segmentation fault.
0x4207c5fc in memcpy () from /lib/tls/libc.so.6
(gdb) bt
#0  0x4207c5fc in memcpy () from /lib/tls/libc.so.6
#1  0x4019dc51 in _TIFFmemcpy () from /usr/local/lib/libgdal.so.1
#2  0x4017be7f in _TIFFsetByteArray () from /usr/local/lib/libgdal.so.1
#3  0x4017bf18 in _TIFFsetShortArray () from /usr/local/lib/libgdal.so.1
#4  0x4017c91d in _TIFFVSetField () from /usr/local/lib/libgdal.so.1
#5  0x4017d104 in TIFFVSetField () from /usr/local/lib/libgdal.so.1
#6  0x4017d0ca in TIFFSetField () from /usr/local/lib/libgdal.so.1
#7  0x40110a77 in GTiffRasterBand::SetColorTable(GDALColorTable*) () from /usr/local/lib/libgdal.so.1
#8  0x401b366a in GDALSetRasterColorTable () from /usr/local/lib/libgdal.so.1
#9  0x0804aa30 in GDALWarpCreateOutput(void*, char const*, char const*, char const*, char const*, int, char**, GDALDataType) ()
#10 0x0804a015 in main ()
#11 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6


It seems to be a problem of the large color table.
I have stored the file here:
 http://mpa.itc.it/markus/tmp/hanoi_lsat7_brovey_UTM48N.img.gz
 (64 MB)

Thanks for any advice

Markus



More information about the Gdal-dev mailing list