Binary Grid scaling

Frank Warmerdam fwarmerdam at GMAIL.COM
Tue Aug 16 11:50:56 PDT 2005


On 8/16/05, Renaud <listsbox at fastmail.fm> wrote:
> One of the layers of our map is a raster image (see gdalinfo output)
> which represents a piece of land, surrounded by a NODATA area. The
> display through mapserver is correct as long as the displayed area
> doesn't include any NODATA dots. Sadly, if a part of the displayed box
> has a NODATA area, the latter appears black while the land is white.
> 
> Driver: AIG/Arc/Info Binary Grid
> Size is 5072, 2944
> Coordinate System is `'
> Origin = (41800.000000,168200.000000)
> Pixel Size = (50.00000000,-50.00000000)
> Corner Coordinates:
> Upper Left  (   41800.000,  168200.000)
> Lower Left  (   41800.000,   21000.000)
> Upper Right (  295400.000,  168200.000)
> Lower Right (  295400.000,   21000.000)
> Center      (  168600.000,   94600.000)
> Band 1 Block=317x4 Type=Float32, ColorInterp=Undefined
>    Min=0.024 Max=0.264
>    NoData Value=-3.40282e+38
> 
> 
> It seems to be a scaling problem... We have played around with
>   *the PROCESSING "SCALE=AUTO" or "NODATA=..." options,
>   *classes etc.
> from within the mapfile, and tried to convert the image to another
> format with gdal_translate, but nothing worked.

Renaud, 

It should be sufficient to use the line:

  PROCESSING "SCALE=0.024,0.264"

in your layer definition. This tells GDAL to manually scale the values
from 0.024 to 0.264.  The nodata areas will likely be displayed in white.
If you need the nodata areas to be show transparent, then other 
mechanisms may be needed.  For instance, 

gdal_translate -scale 0.024 0.280 -a_nodata 255 in/hdf.adf out.tif

should rescale the image, and translate all nodata pixels to the value
255 which will be marked as nodata. 

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the MapServer-users mailing list