Class or filter expression on date field in shapefile

Ei Fujioka efujioka at DUKE.EDU
Mon Oct 29 15:34:58 PDT 2007


Hello experts,

I'm having difficulty in trying to filter features in a shapefile by dates.

I looked into this mailing list and have found a post saying "MapServer 
doesn't support date types in shapefiles."
This post is a very old one, dated in July 2000.

So I'm wondering if the latest Mapserver supports this. And if so, what 
is the date format for class/filter expression?
I use Mapserver 4.2.


Giving up using the date type field, I converted the date field to a 
string or numeric field and was only successful with a numeric field 
(e.g. 20030101 for 2003-03-01).
Can't I use a string value like '2003-03-01' for date comparison?
I tried the following expression but failed.
EXPRESSION ([DATE_S] > '2003-01-01')

Is there any smarter way to filter on dates?


Here is the snippet of the working mapfile with a numeric date field 
"DATE_I".

LAYER
   NAME "MY SHAPEFILE"
   STATUS DEFAULT
   DATA "my_shafile"
   TYPE LINE
   TRANSPARENCY 0
   CLASS
     EXPRESSION ([DATE_I] > 20030101 AND [DATE_I] < 20030201)
     SYMBOL "solid_line"
     COLOR 255 0 0
     OUTLINECOLOR 255 0 0
     SIZE 3
   END
END


Thanks,

Ei


-- 
======================
   Ei Fujioka
   Research Associate
   Duke University

   (919) 613-8021
   efujioka at duke.edu
======================



More information about the MapServer-users mailing list