[mapserver-users] RE: CLASS EXPRESSION regex help?
Stephen Woodbridge
woodbri at swoodbridge.com
Fri Jul 23 08:51:15 PDT 2010
Johan Forsman wrote:
> Thanks Steve, that appears to work!
>
> I did not realize MapServer would on its own accord exclude the
> already CLASSified records from the second CLASS unless I explicitly
> instructed it what to exclude. I presumed it would just draw them
> again together with the rest. Nice!
You can think if the CLASSes as a SWITCH or CASE statement. Records are
read from the data source and each CLASS EXPRESSION is tested and the
first that matches is the one that draws the object, then a new object
is fetched. So a couple of tricks that you can do are:
1. if you have a CLASS at the end with NO expression it acts like the
"default" class in a switch.
2. if you do NOT want to draw some class of objects you can FILTER them
which is faster, but you can also create a CLASS with an EXPRESSION to
recognize them like:
CLASS
EXPRESSION /dont draw this/
END
This will trap these but there are not draw commands so nothing is rendered.
-Steve W
> Thanks!
>
> Now back to monitoring the brewing storm in the Gulf.
>
>> -----Original Message----- From: Lime, Steve D (DNR)
>> [mailto:Steve.Lime at state.mn.us] Sent: Friday, July 23, 2010 10:01
>> AM To: Johan Forsman; mapserver-users at lists.osgeo.org Subject: RE:
>> CLASS EXPRESSION regex help?
>>
>> Hi Johan: Are you looking for just two classes, one for records
>> that start with "LADE" and another for everything else? If so you
>> can just omit the expression from the second class and it will
>> function as a default class so everything that doesn't match the
>> first will be assigned the second. It's faster to execute than
>> trying to expressly define a second regex. Doesn't solve the regex
>> error but then again you may not need to.
>>
>> Steve
>>
>> -----Original Message----- From:
>> mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-
>> bounces at lists.osgeo.org] On Behalf Of Johan Forsman Sent: Friday,
>> July 23, 2010 9:20 AM To: mapserver-users at lists.osgeo.org Subject:
>> [mapserver-users] CLASS EXPRESSION regex help?
>>
>> All:
>>
>> Regex neophyte, using MS 5.4.2 in FGS on Ubuntu Server 9.10, I wish
>> to render two classes based on content in a PostGIS field.
>>
>> For the first CLASS I want all records that start with "LADE", and
>> using
>>
>> NAME "LADE" EXPRESSION /^LADE.*/
>>
>> appears to return the expected records.
>>
>> However, for the second CLASS I want all records that DO NOT start
>> with "LADE", but using
>>
>> NAME "Other" EXPRESSION /^(?!LADE).*/
>>
>> does not return any records and the log contains
>>
>> msEvalExpression() error: Regular expression error. Invalid regular
>> expression.
>>
>> Examples out in the ether all indicate that this "negative
>> lookahead" is supposed to do exactly what I want.
>>
>> What am I doing wrong in this instance?
>>
>> Thanks! /Johan.
>>
>> ---------------------- Johan Forsman Geologist Safe Drinking Water
>> Program Louisiana Department of Health and Hospitals Office of
>> Public Health Telephone: 225.342.7309 Telefax: 225.342.7303
>>
>>
>> _______________________________________________ mapserver-users
>> mailing list mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> _______________________________________________ mapserver-users
> mailing list mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list