Using functions with EXPRESSION
Sergey Miltchakov
redddis at BK.RU
Tue Jul 12 12:45:28 PDT 2005
> You might want to post your mapfile so we can help with that.
Okay, I'll try.
I did a query in the beginning of my php file, which returned an array
'my_years' with the year values.
$Layer = ms_newLayerObj($map);
$Layer->set("name", "test");
$Layer->set("type", MS_LAYER_POLYGON);
$Layer->set("connectiontype", MS_POSTGIS);
$Layer->set("connection","host=localhost port=5432 user=postgres password=''
dbname=testgis");
$Layer->set("data","the_geom from vydely");
$Layer->set("status", MS_ON);
for ($i=0;$i<count($my_years);$i++)
{
$tmpclass2[$i] = ms_newClassObj($Layer);
$tmpclass2[$i]->set("status", MS_ON);
$tmpstyle2[$i] = ms_newStyleObj($tmpclass2[$i]);
$tmpstyle2[$i]->color->setRGB($i*40,$i*40,100); // to somehow differentiate
//$tmpclass2[$i]->setexpression("([id] = $i)"); (this works with my current
query (the_geom from vydely)!!!
//$tmpclass2[$i]->setexpression("(date_part('year',data_rubki) as [foo] =
2004)"); - I want it to work like this!
$tmpclass2[$i]->setexpression("([data_rubki] = '2000-04-13')"); //this does
not work either!
};
Regards,
Sergey
More information about the MapServer-users
mailing list