[mapserver-users] tiff raster files are not being displayed properly

Don harterc1 at comcast.net
Mon Oct 20 22:17:41 EDT 2008


Here is a html version of my post.
http://home.comcast.net/~harterc1/rasterbug.html


I was getting output like below from may tiff files which were tiled by
mapserver.



I took look at each tiff file and examined them with utilities. The tiff
files that did not seem to work were encoded with big endian. I
converted one such file to little endian, but that did not fix the trouble.

This is the one that did not display properly:
drh:/srv/www/htdocs>tiffdump data/tn_topo2/o36087a2.tif
data/tn_topo2/o36087a2.tif:
Magic: 0x4d4d <big-endian> Version: 0x2a
Directory 0: offset 8336360 (0x7f33e8) next 0 (0)
SubFileType (254) LONG (4) 1<0>
ImageWidth (256) SHORT (3) 1<5254>
ImageLength (257) SHORT (3) 1<6699>
BitsPerSample (258) SHORT (3) 1<8>
Compression (259) SHORT (3) 1<32773>
Photometric (262) SHORT (3) 1<3>
ImageDescription (270) ASCII (2) 61<USGS GeoTIFF DRG 1:24000 ...>
StripOffsets (273) LONG (4) 6699<8 92 176 260 344 428 512 596 680 764
848 932 1018 1109 1206 1300 1388 1474 1560 1648 1738 1824 1910 1998 ...>
SamplesPerPixel (277) SHORT (3) 1<1>
RowsPerStrip (278) SHORT (3) 1<1>
StripByteCounts (279) LONG (4) 6699<84 84 84 84 84 84 84 84 84 84 84 86
91 97 94 88 86 86 88 90 86 86 88 86 ...>
XResolution (282) RATIONAL (5) 1<250>
YResolution (283) RATIONAL (5) 1<250>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
Software (305) ASCII (2) 43<USGS CD Archiver program ...>
DateTime (306) ASCII (2) 20<1996:11:04 17:10:55\0>
Colormap (320) SHORT (3) 768<0 65280 0 51968 33536 51456 35072 65280
42752 65280 55808 53504 52992 0 0 0 0 0 0 0 0 0 0 0 ...>
33550 (0x830e) DOUBLE (12) 3<2.4384 2.4384 0>
33922 (0x8482) DOUBLE (12) 6<0 0 0 476702 3.99841e+06 0>
34735 (0x87af) SHORT (3) 20<1 0 2 4 1024 0 1 1 1025 0 1 1 3072 0 1 26716
3073 34737 25 0>
34737 (0x87b1) ASCII (2) 26<UTM Zone 16 N with NAD27 ...>

drh:/srv/www/htdocs>tiffinfo data/tn_topo2/o36087a2.tif
TIFFReadDirectory: Warning, data/tn_topo2/o36087a2.tif: unknown field
with tag 33550 (0x830e) encountered.
TIFFReadDirectory: Warning, data/tn_topo2/o36087a2.tif: unknown field
with tag 33922 (0x8482) encountered.
TIFFReadDirectory: Warning, data/tn_topo2/o36087a2.tif: unknown field
with tag 34735 (0x87af) encountered.
TIFFReadDirectory: Warning, data/tn_topo2/o36087a2.tif: unknown field
with tag 34737 (0x87b1) encountered.
TIFF Directory at offset 0x7f33e8 (8336360)
Subfile Type: (0 = 0x0)
Image Width: 5254 Image Length: 6699
Resolution: 250, 250 pixels/inch
Bits/Sample: 8
Compression Scheme: PackBits
Photometric Interpretation: palette color (RGB from colormap)
Samples/Pixel: 1
Rows/Strip: 1
Planar Configuration: single image plane
Color Map: (present)
ImageDescription: USGS GeoTIFF DRG 1:24000 Quad of White Bluff.
Product:486355
Software: USGS CD Archiver program tif2usgsdrg v.1.0
DateTime: 1996:11:04 17:10:55
Tag 33550: 2.438400,2.438400,0.000000
Tag 33922: 0.000000,0.000000,0.000000,476701.795786,3998406.010399,0.000000
Tag 34735: 1,0,2,4,1024,0,1,1,1025,0,1,1,3072,0,1,26716,3073,34737,25,0
Tag 34737: UTM Zone 16 N with NAD27|





And this is the one that did display properly:
tiffdump data/tn_topo2/o35087h2.tif
data/tn_topo2/o35087h2.tif:
Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 7225380 (0x6e4024) next 0 (0)
ImageWidth (256) SHORT (3) 1<5577>
ImageLength (257) SHORT (3) 1<6930>
BitsPerSample (258) SHORT (3) 1<8>
Compression (259) SHORT (3) 1<32773>
Photometric (262) SHORT (3) 1<3>
StripOffsets (273) LONG (4) 6930<8 98 188 282 372 464 558 659 757 860
961 1082 1218 1347 1451 1544 1638 1732 1826 1924 2018 2114 2212 2302 ...>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<1>
RowsPerStrip (278) SHORT (3) 1<1>
StripByteCounts (279) LONG (4) 6930<90 90 94 90 92 94 101 98 103 101 121
136 129 104 93 94 94 94 98 94 96 98 90 104 ...>
PlanarConfig (284) SHORT (3) 1<1>
Colormap (320) SHORT (3) 768<0 65280 0 51968 33536 51456 35072 65280
42752 65280 55808 53504 52992 0 0 0 0 0 0 0 0 0 0 0 ...>
33550 (0x830e) DOUBLE (12) 3<2.4 2.4 1>
33922 (0x8482) DOUBLE (12) 6<0 0 0 476364 3.98449e+06 0>
34735 (0x87af) SHORT (3) 20<1 1 0 4 1024 0 1 1 1025 0 1 1 3072 0 1 26716
3076 0 1 9001>

drh:/srv/www/htdocs>tiffinfo data/tn_topo2/o35087h2.tif
TIFFReadDirectory: Warning, data/tn_topo2/o35087h2.tif: unknown field
with tag 33550 (0x830e) encountered.
TIFFReadDirectory: Warning, data/tn_topo2/o35087h2.tif: unknown field
with tag 33922 (0x8482) encountered.
TIFFReadDirectory: Warning, data/tn_topo2/o35087h2.tif: unknown field
with tag 34735 (0x87af) encountered.
TIFF Directory at offset 0x6e4024 (7225380)
Image Width: 5577 Image Length: 6930
Bits/Sample: 8
Compression Scheme: PackBits
Photometric Interpretation: palette color (RGB from colormap)
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 1
Rows/Strip: 1
Planar Configuration: single image plane
Color Map: (present)
Tag 33550: 2.400000,2.400000,1.000000
Tag 33922: 0.000000,0.000000,0.000000,476363.690000,3984492.570000,0.000000
Tag 34735: 1,1,0,4,1024,0,1,1,1025,0,1,1,3072,0,1,26716,3076,0,1,9001

I then ran this command on the problem file
geotifcp -c packbits -f lsb2msb -t data/tn_topo2/o36087a2.tif
data/tn_topo2/o36087a2bug.tif

This fixed many problems. I changed some of the parameters. It seems
that it is the “-t”/tiled that fixed it. So I may change all the other
problem files this way.

Here is what it looks like after the change.


It looks much better but with a few glitches.





More information about the mapserver-users mailing list