[Mapserver-users] strange results when displaying grid

Ted Quinby quinby at earthit.com
Fri Jul 16 18:03:36 EDT 2004


I have an Arc/Info Binary Grid I'm trying to display in Mapserver.  When 
displayed in ArcView or ArcMap, the grid is fine -- pixel values ranging 
from 1 to 8 and all in the right place.

However, when displaying this grid in Mapserver, a strange thing 
happens.  A small 32 x 32 pixel square appears in the eastern portion of 
the grid.  In further evaluating this 32 x 32 pixel square, pixels that 
should have a value of 3 are being drawn as if the pixel value was 1 and 
pixels that should have a value of 4 are being drawn as 0.  This only 
occurs within this square -- all other pixel values are drawn correctly.

I ran gdalinfo on this grid and got the following results:

Driver:  AIG/Arc/Info Binary Grid
Coordinate System is `'
Origin = (570771.937500,314684.593750)
Pixel Size = (1.00000000,-1.00000000)
Corner Coordinates:
Upper Left ( 570771.938, 314684.594)
Lower Left ( 570771.938, 314066.594)
Upper Right ( 571624.938, 314684.594)
Lower Right ( 571624.938, 314066.594)
Center ( 571198.438, 314375.594)
Band 1 Block=32x32 Type=Byte, ColorInterp=Undefined
	Min=1.000 Max = 8.000
	NoData Value = 255

This leads me to believe that the values indeed range from 1 to 8 as 
displayed in the ESRI tools.  Why, when drawn in Mapserver, are a select 
group of 4 values being drawn as 0?  There should be no 0 values in the 
grid?  Why are a select number of 3 values being switched to 1?

The plot thickens -- when I convert the grid to a tif and display the tif 
in Mapserver, all values are displayed correctly.

I know the simple solution is just to be happy with the tif -- don't use 
the grid. However, I'm curious what's going on here.

Am I dealing with a corrupted grid somehow or is Mapserver 
reading/displaying a valid grid incorrectly?

Anybody experience something similar or have any debugging thoughts?

Details for the raster layer in the mapfile are as follows:

LAYER
   NAME "em"
   GROUP "geophys_raster"
   METADATA
	     "title" "Electromagnetic Conductivity (mS/m)"
   END
   STATUS OFF
   DATA  "geophys/emgrid"
   #DATA "geophys/emtest.tif"
   TYPE RASTER

   CLASSITEM "[pixel]"
   CLASS
     NAME 'Other'
     EXPRESSION ( [pixel] == 0 )
     COLOR 0 0 0
    END
   CLASS
     NAME '-3 - 20'
     EXPRESSION ( [pixel] == 1 )
     COLOR 23 0 220
   END
   CLASS
     NAME '20 - 25'
     EXPRESSION ( [pixel] == 2 )
     COLOR 20 0 254
   END
   CLASS
     NAME '25 - 30'
     EXPRESSION ( [pixel] == 3 )
     COLOR 85 70 254
   END
   CLASS
     NAME '30 - 35'
     EXPRESSION ( [pixel] == 4 )
     COLOR 165 166 254
   END
   CLASS
     NAME '35 - 40'
     EXPRESSION ( [pixel] == 5 )
     COLOR 255 255 255
   END
   CLASS
     NAME '40 - 45'
     EXPRESSION ( [pixel] == 6 )
     COLOR 254 160 160
   END
   CLASS
     NAME '45 - 50'
     EXPRESSION ( [pixel] == 7 )
     COLOR 254 70 70
   END
   CLASS
     NAME '> 78'
     EXPRESSION ( [pixel] == 8 )
     COLOR 255 0 0
   END
END

Thanks in advance for your response!

Ted




More information about the mapserver-users mailing list