[Mapserver-users] Class Expression help
Nick Petersen-Bergeron
bergeron at zedxinc.com
Thu Jul 17 11:26:26 PDT 2003
Aha! Discovered an error in the .dbf (it contained extra lines) that made
it impossible to compare to the mapfile (there need to be the same number
of lines in the dbf as there are shapes). I unquoted the expression
strings, and then everything worked. Thanks a lot for your help.
At 12:44 PM 7/17/2003 -0500, Steve Lime wrote:
>You've gone through a few gyrations, what's it look like now? The whole
>expression must
>be unquoted to be recognized as a logical expression. I wonder if other
>user's suggestions
>may have cause the parser error.
>
> EXPRESSION (('[TEMP]' eq 'normal') AND ('[PRECIP]' eq 'normal') AND
> ([LEVEL] eq 0) AND ([DAY] eq 30))
>
>Look's fine to me, assuming the values for LEVEL and DAY are always numbers.
>
>Steve
>
> >>> Nick Petersen-Bergeron <bergeron at zedxinc.com> 07/17/03 11:50AM >>>
>Unquoting the entire expression produces an expression parser error.
>
>At 01:08 PM 7/17/2003 -0300, you wrote:
> >El jue, 17 de 07 de 2003 a las 12:22, Nick Petersen-Bergeron escribió:
> >>
> >>As a followup, when I quote the column name, I get the error:
> >>Thu Jul 17 11:29:04 2003 - msEvalExpression(): General error message.
> >>Cannot evaluate expression, no item index defined.
> >>
> >>While this error seems more pertinent, an Item Index shouldn't be necessary
> >>should it?
> >
> >
> >The whole expression shouldn't been unquoted?
> >
> ><SIC> EXPRESSION [string] Three types of expressions are now supported to
> >define class membership. String comparisons, regular expressions, and
> >simple logical expressions. If no expression is given, then all features
> >are said to belong to this class.
> >String comparisons are case sensitive and are the fastest to evaluate. No
> >special delimiters are necessary although string must be quoted if they
> >contain special characters. (As a matter of good habit, it is recommended
> >you quote all strings).
> >
> >Regular expressions function just like previous versions of MapServer.
> >However, you must now delimit a regular expression using /regex/. No
> >quotes should be used.
> >
> >Logical expressions allow you to build fairly complex tests based on one
> >or more attributes and therefore are only available with shapefiles.
> >Logical expressions are delimited by parentheses "(expression)". Attribute
> >names are delimited by square brackets "[ATTRIBUTE]". These names are case
> >sensitive and must match the items in the shapefile. For example:
> >EXPRESSION ([POPULATION] > 50000 AND '[LANGUAGE]' eq 'FRENCH') ... The
> >following logical operators are supported :
> >=,>,<,<=,>=,=,or,and,lt,gt,ge,le,eq. As you might expect this level of
> >complexity is slower to process.
> >String comparisons and regular expressions work from the classitem defined
> >at the layer level. You may mix expression types within the different
> >classes of a layer.
> >
> ></SIC>
> >
> >
> >
> >
> >>
> >>
> >>
> >>
> >>At 05:01 PM 7/17/2003 +0200, Vincent Schut wrote:
> >> >Nick,
> >> >jsut a guess, but have you tried it with [LEVEL] and [DAY] single
> >> quoted too?
> >> >I think you always need to quote your attribute column names.
> >> >
> >> >Regards,
> >> >Vincent.
> >> >
> >> >On Thursday 17 July 2003 16:50, Nick Petersen-Bergeron wrote:
> >> > > I'm trying to do a class based layer structure for a map program I'm
> >> > > writing. I've looked through all of the syntax examples for
> expressions
> >> > > that I can find, but can't seem to figure out what's wrong.
> >> > >
> >> > > I have around 20 classes in the layer. Essentially the only thing
> that
> >> > > will differ between classes is the color.
> >> > >
> >> > > I've included an example of one of the classes.
> >> > >
> >> > > CLASS
> >> > > EXPRESSION "(('[TEMP]' eq 'normal') AND
> ('[PRECIP]' eq
> >> > > 'normal') AND ([LEVEL] eq 0) AND ([DAY] eq 30))"
> >> > > COLOR 50 50 50
> >> > > SIZE 5
> >> > > NAME "normal_city"
> >> > > SYMBOL "circle"
> >> > > LABEL
> >> > > COLOR 50 50 50
> >> > > FONT arial
> >> > > SIZE 12
> >> > > POSITION ur
> >> > > ANTIALIAS TRUE
> >> > > TYPE TRUETYPE
> >> > > END
> >> > > END
> >> > >
> >> > > Can anyone see a problem with this?
> >> > >
> >> > > When I comment out a single expression, the shapefile I'm using
> >> defaults to
> >> > > using that class, so I'm guessing that none of the expressions are
> >> > > evaluating to true. However, the dbf for the shape seems to
> >> indicate that
> >> > > this should not be the case. The only error being thrown is the
> >> following:
> >> > >
> >> > >
> >> > > Thu Jul 17 10:41:37 2003 - msSearchDiskTree(): Unable to access file.
> >> > > Unable to open spatial index for
> /home/wcs/html/data/countries2.qix. In
> >> > > most cases you can safely ignore this message, otherwise check file
> >> names
> >> > > and permissions.
> >> > >
> >> > >
> >> > > Thanks for your help.
> >>
> >>Nick Petersen-Bergeron
> >>System Administrator
> >>
> >>ZedX Inc.
> >>369 Rolling Ridge Drive
> >>Bellefonte, PA. 16823
> >>
> >>_______________________________________________
> >>Mapserver-users mailing list
> >>Mapserver-users at lists.gis.umn.edu
> >><http://lists.gis.umn.edu/mailman/listinfo/mapserver-users>http://lists.
> gis.umn.edu/mailman/listinfo/mapserver-users
> >
> >Nick Petersen-Bergeron
> >System Administrator
> >
> >ZedX Inc.
> >369 Rolling Ridge Drive
> >Bellefonte, PA. 16823
>
>
>_______________________________________________
>Mapserver-users mailing list
>Mapserver-users at lists.gis.umn.edu
>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
Nick Petersen-Bergeron
System Administrator
ZedX Inc.
369 Rolling Ridge Drive
Bellefonte, PA. 16823
More information about the MapServer-users
mailing list