converting a .map file into php mapscript

Mario mmichelli at GMAIL.COM
Wed Nov 1 07:27:40 EST 2006


I'm trying to learn mapscript by converting a .map file into php mapscript
that does not use the file.
It's going well except for not being able to duplicate a very simple piece
of mapfile to mapscript.

The main problem is FEATURE I think.

I have also manipulating the layer with php and have success except for
changing the text or the point, again the features.

Anyone got a spare minute to set me straight

    LAYER
        NAME "credits"
        STATUS DEFAULT
        TRANSFORM FALSE
        TYPE ANNOTATION
        FEATURE
            POINTS
                200 150
            END
            TEXT 'Hello world.  Mapserver rocks.'
        END
        CLASS
            LABEL
                TYPE BITMAP
                COLOR 0 0 0
            END
        END
    END

This is my attempt:
//credits

//add layer to map
$layerCredits = ms_newLayerObj($map);
$layerCredits->set("name", "writeSomething");
$layerCredits->set("type", MS_LAYER_ANNOTATION);
$layerCredits->set("transform", MS_FALSE);
$layerCredits->set("status", MS_DEFAULT);


//make shape
$shapeCredits =  ms_newShapeObj(MS_SHAPE_POINT);
$shapeCredits->text ="This should be on the map but is not";

//make line
$lineCredits = ms_newLineObj();

//make point
$pointCredits = ms_newPointObj();
$pointCredits->setXY(50,20);

//add point to line
$lineCredits->add($pointCredits);


//add line to shape
$shapeCredits->add($lineCredits);

//add shape to layer
$layerCredits->addFeature($shapeCredits);

//set up  class
$classCredits  = ms_newClassObj($layerCredits);

//set up label
$classCredits->label->set("position", MS_CR);
$classCredits->label->set("type", MS_BITMAP);
$classCredits->label->color->setRGB(255,0,125);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20061101/eb8d3466/attachment.html


More information about the mapserver-users mailing list