[mapserver-users] PHP layer->updateFromString problem setting type and symbol name

Daniel Morissette dmorissette at mapgears.com
Fri Jan 22 11:29:32 EST 2010


Sounds like a bug to me. Could you please file a ticket in Trac 
(http://trac.osgeo.org/mapserver/) about this under the "MapScript-PHP" 
component and one of us will have a look?

Daniel


Joe Franklin wrote:
> I really like the updateFromString functions in Mapserver Mapscript.  I've
> eliminated my .map files, instead storing the layer definitions in a database and drawing them on-demand using PHP.  However, I've found a few values ($layer->type and $style->symbolname) that aren't correctly set using Mapserver 5.6.1 (also tried 5.4.2).  Here's an example:
> 
> <?php
> $mapDef="MAP
> NAME 'test'
> SIZE 400 400
> EXTENT 0 0 100 100
> END
> ";
> 
> $layerDef="LAYER
> NAME 'Airports'
> STATUS ON
> TYPE point
> FEATURE POINTS 10 10 50 50 1 50 70 10 END END
> CLASS
> STYLE
> SYMBOL 'airport.gif'
> END
> END
> END";
> 
> $oMap = ms_newMapObjFromString($mapDef);
> $oLayer=ms_newLayerObj($oMap);
> $oLayer->updateFromString($layerDef);
> //First problem: returns -1
> //echo $oLayer->type;
> //$oLayer->set("type",MS_LAYER_POINT);
> 
> //Second problem is that the symbol gif isn't used
> //unless it is explicitly set again below
> //$cls = $oLayer->getClass(0);
> //$style = $cls->getStyle(0);
> //if($style->symbolname!='')$style->set("symbolname",$style->symbolname);
> $oMap->selectOutputFormat('gif');
> $img = $oMap->draw();
> $img->saveImage("output.gif");
> ?>
> 
> 
>       
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


-- 
Daniel Morissette
http://www.mapgears.com/


More information about the mapserver-users mailing list