adding a layer programmatically with PHP

Kristjan Annus kristjan at TARKVARASTUUDIO.EE
Thu Mar 3 23:39:10 PST 2005


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