[mapserver-users] contours in mapfile

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu Apr 8 13:59:32 EDT 2010


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/





Oz Nahum wrote:
> Hi Everyone,
> 
> I am trying to display an ESRI ASCII Raster with map file in a contoured form.
> 
> Despite following the documentation here:
> http://mapserver.org/input/raster.html#how-are-rasters-added-to-a-map-file
> I fail, and get an empty map...
> 
> Here's is what I try in the mapfile:
> 
> MAP
> 
> 
> 
>  #IMAGETYPE     JPEG
>  #                             "minx           miny            maxx
>        maxy"
>  EXTENT         3366307.654280 5813354.151378 3367797.654280 5814955.151378
>  SIZE           640 480
> 
>  IMAGECOLOR     255 255 255
>  FONTSET        "/home/oz/safira/Safira2/trunk/Safira2/DATA/fonts/fonts.list"
> 
> 
> 
> #####################################
> 
>  # Background color for the map canvas -- change as desired
>  #if another color uncomment
>  #IMAGECOLOR 192 192 192
>  IMAGEQUALITY 100
>  IMAGETYPE jpeg
>  OUTPUTFORMAT
>    NAME jpeg
>    DRIVER 'GD/JPEG'
>    MIMETYPE 'image/jpeg'
>    IMAGEMODE PC256
>    EXTENSION 'jpeg'
>  END
> 
> 
>  # Legend
>  LEGEND
>      STATUS embed
>      #IMAGECOLOR 255 255 255
>      POSITION ll
>    #STATUS ON
>    KEYSIZE 10 10
>   LABEL
>         TYPE truetype
>         FONT "arial"
>         COLOR 0 0 0
>         SIZE 8
>         ANTIALIAS true
>    END
>  END
> 
> 
> 
> ### SCALEBAR
>        SCALEBAR
>        #ALIGN center
>        INTERVALS 4
>        POSITION ul #ur
>        SIZE 200 10
>        #Black bounding box
>        OUTLINECOLOR 0 0 0
>        STATUS embed
>        UNITS kilometers
>        LABEL
>        TYPE truetype
>         FONT "arial"
>         COLOR 0 0 0
>         SIZE 8
>         ANTIALIAS true
>        END
>        END
> 
>  LAYER
>    NAME 'W_PCE_in_GW'
>    TYPE RASTER
>    DUMP true
>    TEMPLATE fooOnlyForWMSGetFeatureInfo
>    EXTENT 3365691.535626 5813306.316297 3368142.408444 5815201.783992
>    DATA '/home/oz/safira/Safira2/trunk/Safira2/SzenarioA/ScALayout1/W_PCE_in_GW.asc'
>    METADATA
>      'ows_title' 'W_PCE_in_GW'
>    END
>    STATUS ON
>    CLASSITEM "[pixel]"
>    #MAXSCALE 500000
>    CLASS
>        NAME "NO DATA"
>        EXPRESSION (([pixel] == -9999))
>        COLOR 0 0 255
>         STYLE
>         #SYMBOL 0
>         #SIZE 4
>         #OUTLINECOLOR 0 0 255
>         #COLOR 243 162 0
>       END
>    END
>    CLASS
>        NAME "0 - 5"
>        EXPRESSION (([pixel] >= 0 AND ([pixel] <=5))
>        COLOR 200 0 0
>         STYLE
>         SYMBOL 0
>         SIZE 2
>         OUTLINECOLOR 0 0 0
>         #COLOR 243 162 0
>       END
>    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
> 
>    TRANSPARENCY 100
>    PROJECTION
>    'proj=longlat'
>    'ellps=WGS84'
>    'datum=WGS84'
>    'no_defs'
>    END
>  END
> 
> 
> 
> END
> 
> I also attach the raster file as zip.
> 
> Can someone tell me what am I doing wrong ?
> 






More information about the mapserver-users mailing list