[Mapserver-users] creating a new layer with PHP/Mapscript

eric.belenfant eric.belenfant at ac-orleans-tours.fr
Thu Jul 1 05:55:41 EDT 2004


Hi,

i'm using php mapscript 4.0 and .tab files from MAPINFO.
I try to generate some layers on the fly with php.
Here is the piece of code

$couche_modele = $map->getLayerByName("couche_modele");
        $modele_classe = $couche_modele->getClass(0);
       
        /////////////////////////////////////////////
        // Affichage/Masquage des couches
        /////////////////////////////////////////////

        $layer = *ms_newLayerObj*($map,$couche_modele);
        $layer->set("name","total_sts");
        $layer->set("classitem","total_sts");
        $class = ms_newClassObj($layer);
        $class->setexpression("[total_sts]>0");
        $style = ms_newStyleObj($class);
        $style->color->setRGB(255,255,200);
       
        $colorSTS = rgb2html(Array(    $style->color->red,
                                    $style->color->green,
                                    $style->color->blue));

        if (isset($HTTP_POST_VARS["total_sts"])){
            print_r($map->getLayersdrawingorder());
            $layer->set("status",MS_ON);
            $checkSTS="CHECKED";
        }else
            $layer->set("status",MS_OFF);

The new layer i create is not visible, however all the propoerties of 
the layer are OK when i echo them .

What is wrong in my code ?
Am i missing something ?

eric




More information about the mapserver-users mailing list