adding a layer programmatically with PHP
Keith Boyle
kboyleAlt at YAHOO.COM
Wed Mar 16 10:03:57 PST 2005
thanks Kristjan, sorry for the late reply.
I also found that the numlayers property isn't updated when you use
ms_newLayerObj() and that using $map->getAllLayerNames() and iterating over
the list seems a decent workaround. My layer controls were not being created
, since I was looping over numlayers.
cheers,
-Keith
On Fri, 4 Mar 2005 09:39:10 +0200, Kristjan Annus
<kristjan at TARKVARASTUUDIO.EE> wrote:
>Here is one sample how to create layer in PHP, may be this could help.
>
> $layer = ms_newLayerObj($map);
> $layer->set("name", "points");
> $layer->set("type", MS_LAYER_POINT);
> $layer->set("status", MS_ON);
>
> $class = ms_newClassObj($layer);
> $class->set("status", MS_ON);
> $class->label->set("type", MS_TRUETYPE);
> $class->label->set("font", 'arial');
> $class->label->color->setRGB( 200,200,200);
> $class->label->outlinecolor->setRGB(255, 255, 255);
> $class->label->set("size", 12);
> $class->label->set("position", 9);
>
> $style = ms_newStyleObj($class);
> $style->set("symbol", $map->getsymbolbyname( 'circle'));
> $style->set("size", 8);
> $style->color->setRGB( 200,200,200);
> $style->outlinecolor->setRGB(255, 255, 255);
>
>Kristjan
>
>>I'm trying to add Classes to Layers and copied Layers to a Map through
>>PHPMapScript, but can't find a way in the documentation/faq/mail archive.
>>This seems really basic, so must just be missing something obvious and
>>simple. Can anyone give me a quick pointer?
>>
>>thanks for any help,
>>-Keith
>>
>>
More information about the MapServer-users
mailing list