MapServer LAYER>FILTER Object

The Filter class allows you to split out data from your source map files e.g. .TAB, SHP etc. to create separate layers which may be turned on or off. In the following example we take the original MapInfo tab file Street_Lighting.TAB and split it into two separate layers one WigWagCrossing where the field UNITYPE = “W” and one for TrafficLights where the UNITYPE = “T” e.g.

LAYER
      NAME WigWagCrossing
      TYPE POINT
      STATUS OFF
      CONNECTIONTYPE OGR
      CONNECTION "Overlays/Highways/Street_Lighting.TAB"
      FILTERITEM "UNITTYPE"
      #Wigwag - train crossing
      FILTER ("[UNITTYPE]" == "W")
      CLASS
         STYLE
            SYMBOL "wigwag"
         END
      END
END
LAYER
      NAME TrafficLights
      TYPE POINT
      STATUS OFF
      CONNECTIONTYPE OGR
      CONNECTION "Overlays/Highways/Street_Lighting.TAB"
      FILTERITEM "UNITTYPE"
      #Traffic lights
      FILTER ("[UNITTYPE]" == "T")
      CLASS
         STYLE
            SYMBOL "trafficlights"
         END
      END
END


For full details of the MapServer LAYER>FILTER Object please see the MapServer MAP Documentation.