Using functions with EXPRESSION
Stephen Woodbridge
woodbri at SWOODBRIDGE.COM
Tue Jul 12 12:12:14 PDT 2005
Sergey Miltchakov wrote:
> Hello!
>
> I have a 'mydate' and 'the_geom' fields in my table and want to color the
> shapes on my layer depending on the year of the 'mydate' value. What
> expression do I use in order to do that? Is it possible to use postgre
> 'date_part' function at all?
>
> I tried several ways but none helped me. It just returns blank image
> (without the layer). Other expressions work fine.
Hi Sergey,
You might want to post your mapfile so we can help with that.
In general, I have been doing thematic mapping with postGIS and I
usually try to classify the data in SQL and return back a normalized
theme value between 1 and N, then I make my LAYER like:
LAYER
CONNECTIONTYPE postgis
CONNECTION "...."
DATA "the_geom from (select the_geom, (<classification expression>)
as theme from data_table where <blah blah blah>) as foo using unique gid
using srid 4326"
CLASSEXPRESSION theme
CLASS
EXPRESSION 1
....
END
CLASS
EXPRESSION 2
...
END
...
CLASS
# no EXPRESSION is default catch all
...
END
END
YMMV,
-Steve W.
More information about the MapServer-users
mailing list