[Mapserver-users] Classes and Layers
Benjamin Wragg
bwragg@tpg.com.au
Fri, 24 Jan 2003 17:35:17 +1030
Hi Guys,
I'm trying to add a class to a PostGIS layer that is already defined in
a mapfile. What I'm trying to do is pass the gid of a feature from a
user and create a class only showing the feature selected. The code is
shown below:
$featureID=X //passed in from user
$layer=$map->getlayerbyname('testpoints');
$class=ms_newClassObj($layer);
$class->set("name", "Selected Feature");
$class->setexpression('gid=$featureID');
$colorId=$map->addColor(255,0,0);
$class->set("color", $colorId);
$class->set("size", 10);
$layer->set("status", MS_ON);
$image=$map->draw();
$imageURL$image->saveWebImage(MS_PNG,1,1,0);
The layer in the map file is as follows:
LAYER
CONNECTIONTYPE postgis
NAME "testpoints"
CONNECTION "user=user password=password dbname=dbname
host=localhost"
DATA "the_geom from testpoints"
STATUS ON
TYPE POINT
CLASS
NAME "All Features"
COLOR 0 0 0
SIZE 10
SYMBOL 2
END
END
The map produced is no different. Any ideas?
Thanks,
Benjamin Wragg
_______________________________________________
Mapserver-users mailing list
Mapserver-users@lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users