[mapserver-users] class expression question

Bistrais, Bob Bob.Bistrais at maine.gov
Thu Sep 5 12:11:49 PDT 2013


Thanks Bob!  I've been able to figure out a working regex.

From: Basques, Bob (CI-StPaul) [mailto:bob.basques at ci.stpaul.mn.us]
Sent: Thursday, September 05, 2013 12:23 PM
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] class expression question

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: mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org> [mapserver-users-bounces at lists.osgeo.org] on behalf of Lime, Steve D (MNIT) [Steve.Lime at state.mn.us]
Sent: Thursday, September 05, 2013 10:45 AM
To: Bistrais, Bob; mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
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: mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Bistrais, Bob
Sent: Thursday, September 05, 2013 10:40 AM
To: mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130905/561edebc/attachment.html>


More information about the mapserver-users mailing list