MapServer LAYER>CLASS>EXPRESSION Object
For more information on the use of EXPRESSIONs please refer to the MapServer Documentation.
With a CLASSITEM
If you wish to use more complicated styles for say OS MasterMap layers then you can use the following which will colour according to the value of a field name using EXPRESSION. It is also advisable to have a CLASS entry at the bottom of the list as a “catch all” style for the layer:
POLYGON – OS MasterMap GoLoader
CLASSITEM "OSMMSTYLE_NAME"
CLASS
EXPRESSION "buildingFill"
STYLE
COLOR 255 204 153
OUTLINECOLOR 204 204 204
END
END
CLASS
EXPRESSION "multipleSurfaceFill"
STYLE
COLOR 255 255 204
OUTLINECOLOR 204 204 204
END
END
CLASS
EXPRESSION "0001 Building outline"
STYLE
COLOR 0 0 0
WIDTH 2
END
ENDPOLYGON – OS MasterMap TranspOSe / SuperpOSe
CLASSITEM "Legend"
CLASS
EXPRESSION "0321 Building"
STYLE
COLOR 255 204 153
OUTLINECOLOR 204 204 204
END
END
CLASS
EXPRESSION "0385 Nonconiferous - scattered"
STYLE
COLOR 0 0 0
OUTLINECOLOR 204 204 204
SYMBOL "0385Scattered" #[Draws a bitmap fill type]
END
ENDPOLYLINE – OS MasterMap GoLoader
CLASSITEM "OSMMSTYLE_NAME"
CLASS
EXPRESSION "defaultTopographicLine"
STYLE
COLOR 102 102 102
END
END
CLASS
EXPRESSION "buildingLine"
STYLE
COLOR 0 0 0
WIDTH 2
END
ENDPOLYLINE – OS MasterMap TranspOSe / SuperpOSe
CLASSITEM "Legend"
CLASS
EXPRESSION "0030 Obstructing feature"
STYLE
COLOR 102 102 102
END
END
CLASS
EXPRESSION "0001 Building outline"
STYLE
COLOR 0 0 0
WIDTH 2
END
ENDWith a LABELITEM
GoLoader holds text as lines that require labeling.
LABELITEM - GoLoader
LABELITEM "TEXTSTRING"
#LABELANGLEITEM "OGR:LabelAngle"
MINSCALE 1
MAXSCALE 4000
#REQUIRES "![Aerial]"
#STYLEITEM "auto"
CLASSITEM "FEATURECODE"
CLASS
EXPRESSION ([FEATURECODE] == 10026 OR [FEATURECODE] == 10166 OR [FEATURECODE] == 10178 OR [FEATURECODE] == 10184)
LABEL
FONT "arial"
TYPE TRUETYPE
ANTIALIAS TRUE
COLOR 0 0 0
OUTLINECOLOR 230 230 230
SIZE 7
POSITION cc
ANGLE AUTO
END
END
CLASS
EXPRESSION ([FEATURECODE] == 10033)
LABEL
FONT "arialbd"
TYPE TRUETYPE
#ANTIALIAS TRUE
COLOR 153 153 153
#OUTLINECOLOR 255 255 255
SIZE 15
POSITION cc
ANGLE AUTO
END
ENDTranspOSe / SuperpOSe holds text as an annotation layer therefore no labeling is required.
ANNOTATION – TranspOSe / SuperpOSe
The ANNOTATION type is not supported in iShare v6. To resolve this we suggest that you modify the layer configuration and change the TYPE from ANNOTATON to POINT.
LAYER
NAME CartoText
TYPE ANNOTATION
STATUS DEFAULT
CONNECTIONTYPE OGR
CONNECTION "Base/MasterMap/Carto_Text.TAB"
MINSCALE 1
MAXSCALE 6000
STYLEITEM "auto"
CLASS
END
END