[mapserver-users] Multiple OFFSITE values

Hankley, Chip Chip.Hankley at GASAI.Com
Mon Apr 8 10:29:23 EDT 2002


Many thanks to Frank Warmerdam for helping me figure this one out.
Basically, there doesn't appear to be anyway to specify more than one
OFFSITE value in the mapfile.

Ultimately, what he suggested, which worked great, was to use classes to
define the colors that I want to show. Anything not specified in a class
doesn't render, and is hence transparent.

For this set of images, this was fairly simple, since they only contain 13
color (0 - 12). For a more complex set of images (or a less consistent color
set), this would be a big pain.

If anyone knows how to set a color to be "transparent" outside of the
OFFSITE parameter, that would be a cool addition to this. One could specify
a range of values as a class and color them as transparent:

  CLASS
    EXPRESSION ([pixel] >= 13 AND [pixel] <= 255)
    COLOR [transparent] #whatever [transparent] is...
  END


For reference purposes, the resulting map file is below:

LAYER 
  NAME "DRG" 
  MAXSCALE 500000
  STATUS default
  TILEINDEX "DNR_GeoDISC\quadindx\qdrpw924\qdrppoly.shp"
  TILEITEM "Location"
  TYPE RASTER
  CLASS
    EXPRESSION ([pixel] = 0)
    COLOR 0 0 0
  END
  CLASS
    EXPRESSION ([pixel] = 1)
    COLOR 255 255 255
  END
  CLASS
    EXPRESSION ([pixel] = 2)
    COLOR 0 150 165 
  END
  CLASS
    EXPRESSION ([pixel] = 3)
    COLOR 206 0 16
  END
  CLASS
    EXPRESSION ([pixel] = 4)
    COLOR 132 65 33
  END
  CLASS
    EXPRESSION ([pixel] = 5)
    COLOR 206 235 156
  END
  CLASS
    EXPRESSION ([pixel] = 6)
    COLOR 140 48 132 
  END
  CLASS
    EXPRESSION ([pixel] = 7)
    COLOR 255 235 0
  END
  CLASS
    EXPRESSION ([pixel] = 8)
    COLOR 165 227 231 
  END
  CLASS
    EXPRESSION ([pixel] = 9)
    COLOR 255 186 189
  END
  CLASS
    EXPRESSION ([pixel] = 10)
    COLOR 222 178 214 
  END
  CLASS
    EXPRESSION ([pixel] = 11)
    COLOR 214 211 214
  END
  CLASS
    EXPRESSION ([pixel] = 12)
    COLOR 206 166 140 
  END
END





More information about the mapserver-users mailing list