Class Expressions
Dave Stone
D.Stone at ED.AC.UK
Tue May 16 04:57:21 PDT 2006
Thanks for all that good stuff, Steve. One or two comments below.
Dave
Steve Lime wrote:
> Dave: If these are numbers why are you treating them as strings? Straight string comparison of numbers can be unpredictable. Have you tried removing the quotes?
>
Drowning-man-clutching-at-straws syndrome! I think I'd tried every other
permutation before that.
> Other options:
>
> 1) you can do the classification in PostGIS. Paul Ramsey's workshop materials have some nice examples.
>
That's what I did thereafter. So I now have one layer for each
date-range with DATA definitions like:
DATA "geom from (select dr, geom, stdname, deddlo, deddhi,
oid from saintloc where ((deddlo >= 12010101) AND (deddlo <= 13001231))
OR ((deddhi >= 12010101) AND (deddhi <= 13001231))) as foo using srid=27700"
> 2) MapServer does support true dates in logical expressions. I believe you use backtics to denote dates that way.
>
> That said, I think you can just treat 'em as ints.
>
I did go back and try the EXPRESSION method again, but it seemed to
break down on nulls. E.g.
EXPRESSION ((([deddlo] >= 11010101) AND ([deddlo] <= 12001231))
OR (([deddhi] >= 11010101) AND ([deddhi] <= 12001231)))
worked OK if both deddlo and deddhi contained valid (integer) dates, but
not if either was null.
> Steve
>
>>>> DjwStone <D.Stone at ED.AC.UK> 05/12/06 8:52 AM >>>
> I'm having difficulty setting up an EXPRESSION statement for a PostGIS layer.
>
> The field being tested is a numeric representation of a date in YYYYMMDD
> format so that ranges can be easily compared.
>
> When the expression is (say):
>
> EXPRESSION ('[fieldname]' ge '15010101')
>
> everything works fine; I get the correct number of hits. Similarly,
>
> EXPRESSION ('[fieldname]' le '16001231')
>
> works as it should.
>
> However, when I have:
>
> EXPRESSION ('[fieldname]' ge '15010101') and ('[fieldname]' le '16001231')
>
> I get no hits although there should be some.
>
> Has anyone else had similar problems?
>
> Cheers,
>
> Dave
> --
> View this message in context: http://www.nabble.com/Class-Expressions-t1607707.html#a4358498
> Sent from the Mapserver - User forum at Nabble.com.
>
>
More information about the MapServer-users
mailing list