[mapserver-users] Class Expressions

Steve Lime steve.lime at dnr.state.mn.us
Sat Sep 7 00:35:22 EDT 2002


Funny you should ask. I committed a new version of the expression parser
to the 3.7 and 3.6 CVS trees last night. One of the additions is a not
operator. I've tested it mostly in conjuction with the REQUIRES and
LABELREQUIRES context expressions but it should work fine otherwise. You
can write things like:

  EXPRESSION (!('[TEXT]' =~ /^UNK|^N.A/))

There is no negation operator outside of logical expressions (yet)
although there may be something built into regex.

I think (try it to be sure) that your last idea may work. If a CLASS
does not have a COLOR or OUTLINECOLOR then it is skipped. If so, then
that would be faster than the combination of logical and regular
expressions.

BTW To get at the 3.6 CVS version use:

  cvs -Q checkout -r rel-3-6-0-beta1 mapserver

The branch name is confusing but refers to the current 3.6 source.

Steve

Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> <woodbri at swoodbridge.com> 09/06/02 14:35 PM >>>
Hi all,

In an annotation layer I have a bunch of records the I want to 
ignore. So I'm wondering if simple class expressions have a NOT 
operator? I can't find it in the doc.

CLASS
  NAME "Label these"
  EXPRESSION ([TEXT] != /^UNK|^N.A/)
  LABEL
     ...
  END
END

The other alternative I thought of was to create a do nothing class 
like the following where the items to ignore are caught by the first 
class, but nothing is then done with the item, but if it fails the 
first CLASS the second is a default catch all for the rest.

CLASS
  NAME "Ignore These"
  EXPRESSION /^UNK|^N.A/
END
CLASS
  NAME "Label These"
  LABEL
    ...
  END
END

Does this work?

-Steve




More information about the mapserver-users mailing list