[mapserver-users] compare date in class

Burgholzer,Robert rwburgholzer at deq.virginia.gov
Fri Jun 6 10:12:34 EDT 2008


Don't know if the mapserver operators will deal with dates or not, but
in your postgis DATA string, you can include the following: "now() as
current_date" in order to provide you with the current_date. 

If mapserver does not evaluate dates properly, you could opt to do the
comparison in the DATA query as well, and simply return a "t" or "f" ,
i.e.:
"(now() > startdate) as old", and then your expression reads:

EXPRESSION "[old] = 'f'"

And 

EXPRESSION "[old] = 't'"


HTH,
r.b.

Robert W. Burgholzer
Surface Water Modeler
Office of Water Supply and Planning
Virginia Department of Environmental Quality
rwburgholzer at deq.virginia.gov
804-698-4405
Open Source Modeling Tools:
http://sourceforge.net/projects/npsource/

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of
patruno at istat.it
Sent: Friday, June 06, 2008 9:06 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] compare date in class

Hi list!

I'd like to ask you if there is a way to compare a field date
(mm-gg-yyyy) coming from a PostGIS query with the current date. (and
above all how to get the current date ....)

My goal is to use a point layer with different colours depending on
expression result in the 'class' block.

Ex: 
  CONNECTION 'dbname=xxxx user=username password=password
host=localhost'

   DATA 'the_geom from (select the_geom, id, oid, ...., start_date  from
table) as foo'

.....

CLASS 
   EXPRESSION (current_date > start_date)

NAME "red"
      TEXT ([id])
      STYLE
        COLOR 255 0 0
        OUTLINECOLOR 0 0 0
      END
....



Thanks in advance
Vinc

 
_______________________________________________
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