[mapserver-users] contours in mapfile

Fawcett, David (MPCA) David.Fawcett at state.mn.us
Thu Apr 8 10:42:08 PDT 2010


Oz, 

Between fixing the expression format as Jeff suggested and setting layer STATUS to DEFAULT, I was able to get it to draw.  

I simplified your map file, but I was able to get it to draw with the below map file.

David.

MAP
  EXTENT         3366307 5813354 3367797 5814955
  SIZE           640 480
  IMAGECOLOR     192 192 192
#####################################

  LAYER
    NAME 'W_PCE_in_GW'
    TYPE RASTER
    DATA '/ms4w/apps/gridtest/W_PCE_in_GW.asc'
    STATUS DEFAULT
    CLASS
        NAME "NO DATA"
        EXPRESSION ([pixel] = -9999)
        STYLE
            COLOR 0 0 255
        END
    END
    CLASS
        NAME "0 - 5"
        EXPRESSION ([pixel] >= 0 AND [pixel] <=5)
        COLOR 200 0 0
    END
    CLASS
        NAME "5 - 10"
        EXPRESSION ([pixel] > 10 AND [pixel] <=20)
        COLOR 243 162 0
    END
    CLASS
        NAME "2 - 50"
        EXPRESSION ([pixel] > 20 AND [pixel] <=50)
        COLOR 0 200 0
    END
    CLASS
        NAME "catchall"
        COLOR 0 0 0
    END
   END
END

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Jeff McKenna
Sent: Thursday, April 08, 2010 1:00 PM
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] contours in mapfile

Hello Oz,

First, always test your mapfile with the shp2img commandline utility 
(http://www.mapserver.org/utilities/shp2img.html).  This will either 
produce a map image, or give you an error.

Next, I believe your problem is your expressions.  You should follow the 
examples in http://www.mapserver.org/input/raster.html which states:

    EXPRESSION ([pixel] >= 64 AND [pixel] < 128)

You have:

    EXPRESSION (([pixel] >= 0 AND ([pixel] <=5))

So try:

    EXPRESSION ([pixel] >= 0 AND [pixel] <=5)

Also, give a read to the expression howto, just to get yourself more 
familiar with them: http://www.mapserver.org/mapfile/expressions.html


-jeff


-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/



More information about the MapServer-users mailing list