Bob,

I do it this way (you'll need to figure out your specific REGEX though, I have 
a column (F_CLASS) for classifying the HIGHWAY labels in the data)

##############################
## Symbols (Shields, etc)
##############################

  LAYER
    METADATA
      "ows_title" "road_sym"
      "gml_include_items" "all"
    END
     NAME 'road_sym'
    GROUP 'interstate_poly'
    #TILEINDEX 'TILEINDEX'
    DATA 'DATA/A10A20A25A30'
    STATUS DEFAULT
    TYPE ANNOTATION
    CLASSITEM 'F_CLASS'
    LABELITEM 'HIGHWAY_NU'
    TOLERANCE 1000
    CLASS
      EXPRESSION 'A10' # interstates
      STYLE
        SYMBOL 'interstate1_wide_back'
        SIZE 22
        COLOR 255 0 0
      END
      STYLE
        SYMBOL 'interstate1_wide_front'
        SIZE 22
        COLOR 115 113 206
        OUTLINECOLOR 254 254 254
      END
      LABEL
        TYPE TRUETYPE
        FONT bluehigh
        SIZE 12
        COLOR 254 254 254
        MINDISTANCE 200
        MINFEATURESIZE 10
        OFFSET 0 0
        PARTIALS FALSE
      END
    END

    CLASS
      EXPRESSION 'A20' # US Highway
      STYLE
        SYMBOL 'us_highway_back'
        SIZE 23
        COLOR 254 254 254
      END
      STYLE
        SYMBOL 'us_highway_front'
        SIZE 23
        COLOR 0 0 0
      END
      LABEL
        TYPE TRUETYPE
        FONT bluehigh
        SIZE 11
        COLOR 0 0 0
        MINDISTANCE 250
        MINFEATURESIZE 15
        OFFSET 0 -1
        PARTIALS FALSE
      END
    END

    CLASS
      EXPRESSION 'A25' # MN Highway
      STYLE
        SYMBOL 'mn_highway_back'
        SIZE 23
        COLOR 254 254 254
      END
      STYLE
        SYMBOL 'mn_highway_front'
        SIZE 23
        COLOR 0 0 0
      END
      LABEL
        TYPE TRUETYPE
        FONT bluehigh
        SIZE 11
        COLOR 0 0 0
        MINDISTANCE 250
        MINFEATURESIZE 15
        OFFSET 0 -1
        PARTIALS FALSE
      END
    END
________________________________
From: [email protected] 
[[email protected]] on behalf of Lime, Steve D (MNIT) 
[[email protected]]
Sent: Thursday, September 05, 2013 10:45 AM
To: Bistrais, Bob; [email protected]
Subject: Re: [mapserver-users] class expression question

You can use regexes:

CLASSITEM ‘road_type’
CLASS
  EXPRESSION /^I-/
  …
END

or

CLASS
  EXPRESSION (‘[road_type]’ ~ ‘^I-‘)
   …
END

Steve

From: [email protected] 
[mailto:[email protected]] On Behalf Of Bistrais, Bob
Sent: Thursday, September 05, 2013 10:40 AM
To: [email protected]
Subject: [mapserver-users] class expression question

I’d like to classify road data according to road type.  This includes 
Interstate highways, where the road name attribute starts with “I-“, such as 
“I-95”, “I-295”, etc.  So I’d like to create a class where ‘[roadname]’ like 
‘I-%’


-          What is the correct syntax to do this?
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to