Need help: Annotation layer from Postgis using php
Sergey Miltchakov
redddis at BK.RU
Sat Jul 9 09:16:48 PDT 2005
Hello!
I ran into the following problem with annotations using php:
The thing is I have a table 'vydely' in Postgre with the fields:
gid (int), id(int), area(float), kvartal(int) and the_geom(geometry).
I managed to successfully pull the shapes from this table using php. Now I
need to somehow annotate those shapes. I'd like to add the gid and kavartal
numbers inside the polygons using php.
I use the following code:
$Anlayer = ms_newLayerObj($map);
$Anlayer->set("name","vydelid");
$Anlayer->set("type", MS_LAYER_ANNOTATION);
$Anlayer->set("connectiontype", MS_POSTGIS);
$Anlayer->set("connection","host=localhost port=5432 user=postgres
password='' dbname=testgis");
$Anlayer->set("data", "id from vydely");
$Anlayer->set("status", MS_ON);
$Anlayer -> set("classitem", "id");
$Anlayer -> set("labelitem", "id");
$Anlayer -> {annotate} = 1;
$fredclass = ms_newClassObj($Anlayer);
$fredstyle = ms_newStyleObj($fredclass);
$fredstyle->color->setRGB(222,222,222);
$fredstyle->outlinecolor->setRGB(100,0,0);
$fredclass->label->set("position", 8);
$fredclass->label->set("size", 18);
$fredclass->label->set("minsize",4);
$fredclass->label->set("maxsize",256);
$fredclass->label->color->setRGB(22,22,22);
$fredclass->label->set("font","verdana");
$Anlayer->draw($image);
$map->drawLabelCache($image);
But nothing shows (an image without text layer...
Though I succeeded to show the static text layers, defined in the map file.
Is that possible at all to make them dynamic? I could not find anything
useful in the internet...
Regards,
Sergey
More information about the MapServer-users
mailing list