Try
EXPRESSION ('[object_type]' eq 'agents')
"=" is a numeric comparison, and you want a string comparison. The
extra '' around the attribute name also seem to help clarify things
for the expression parser.
On 23-Jun-06, at 4:10 PM, Nigel Gilbert wrote:
[Many thanks to those who helped me yesterday overcome a problem with
creating an oid index, now solved as a result of their advice]
I have a PostGIS database including a table, world, with columns,
object_type (containing either one of the strings, 'plants' or
'agents') and
'geom', containing points. In my map file I have:
LAYER
NAME World
CONNECTIONTYPE postgis
CONNECTION "user=..... dbname=...."
DATA "geom from world"
STATUS ON
TYPE POINT
CLASS
NAME Agents
EXPRESSION ([object_type] = 'agents')
STYLE
COLOR 255 111 207 # pink
END
END
CLASS
NAME Plants
EXPRESSION ([object_type] = 'plants')
STYLE
COLOR 0 128 64 # green
END
END
END
This gives a map displaying nothing, although if I comment out the
expressions, I get the points I would then expect. In other words,
the
expressions are always returning false. But getting the data
directly:
select object_type, AsText(geom) from world limit 3;
object_type
| astext
----------------------------------------------------------------------
------
--------------------------+----------------
plants
| POINT(13 19)
plants
| POINT(228 840)
plants
| POINT(694 674)
(3 rows)
is fine. What's wrong??
Thanks again!
Nigel