[mapserver-users] multiple matches in $classObj->setexpression

Steve Lime steve.lime at dnr.state.mn.us
Sun Apr 7 14:41:29 EDT 2002


The MapServer parser isn't as smart as it probably could be and doesn't
have the benefit of knowing the type of data being substituted using []
or %% replacement strings. Therefore you must tell it. Try quoting
[GIS_KEY] in the expressions. That tells the parser that the value is a
string.

Steve

Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> Puneet Kishor <pkishor at GeoAnalytics.com> 04/05/02 16:44 PM >>>
with the following in my map file...

LAYER
  NAME "parcels_highlight"
  TYPE polygon
  DATA parcel
  STATUS off
	CLASSITEM "OWNER"
  CLASS
    OUTLINECOLOR 255 0 0
    COLOR 255 255 0
  END
  TEMPLATE "parcels.php"
END

The following works fine...

$str = "foo";
$classObj->setexpression("\"$str\"");
$layerObj->set("status", 1);

But I want to do the following, which, needless to say, does not work...

$str = "([GIS_KEY] in (\"foo\", \"bar\", \"baz\"))";
$classObj->setexpression("\"$str \"");
$layerObj->set("status", 1);


In fact, I can't even get the following to work...

$str = "([GIS_KEY] eq \"foo\")"; OR
$str = "([GIS_KEY] == \"foo\")"; OR 
$str = "([GIS_KEY] eq 'foo')"; etc.


What am I missing here? And if the "in" clause is not supported (doesn't
seem to be per the docs), would I need to do the following...

$str = "(([GIS_KEY] eq \"foo\") or ([GIS_KEY] eq \"bar\") or ([GIS_KEY]
eq
\"baz\"))";

Tia,

pk/




More information about the mapserver-users mailing list