[Mapserver-users] PHP MapScript: dynamically add new layer ?

Daniel Morissette morissette at dmsolutions.ca
Wed Dec 4 10:37:57 EST 2002


"Lars V. Nielsen" wrote:
> 
> My code's as follows:
> 
> $map = ms_newMapObj($map_path.$map_file);
> 
> $lyr = ms_newLayerObj($map);
> $lyr->name = "myLayer";
> $lyr->type = MS_LAYER_RASTER;
> $lyr->status = MS_ON;
> $lyr->data = "myRasterPicture.jpg";
> 

Due to the way the PHP wrappers work internally, you have to use the
set() method to set properties on layer objects and other objects in PHP
MapScript.  i.e.:

 $map = ms_newMapObj($map_path.$map_file);
 $lyr = ms_newLayerObj($map);
 $lyr->set("name", "myLayer");
 $lyr->set("type", MS_LAYER_RASTER);
 $lyr->set("status", MS_ON);
 $lyr->set("data", "myRasterPicture.jpg");
 

Daniel
-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------



More information about the mapserver-users mailing list