No "$objMap->insertLayer" in PHP Mapscript: OK. WORKAROUND NOT NEEDED!

Michael H ärtel haerta at YAHOO.COM
Fri Sep 2 11:00:11 EDT 2005


Hello Again!

Sorry for evoking some confusion with my mail. I
haven't noticed that there is a parameter for the map
object in the ms_newLayerObj function.

by the way the $obj_layer-><someproperty>=value thing
doesn't seem to work with PHP properly. (That's why
the second output didn't show the changed layer
properties I guess. The layer object was refered
correctly so my Assumption about the layer object
being outside the map object probably was incorrect).

I switched to 

$obj_layer->set(<some property> , value)

and this works fine now. I guess I don't need to use 
ms_newLayerObj(MapObj map [, layerObj layer]) in my
case.

Sorry about my mail,

Michael

--- Lowell Filak <lfilak at medinaco.org> wrote:

> The following message was sent by Michael
> H=?ISO-8859-1?Q?=E4rtel?=
> <haerta at YAHOO.COM> on Fri, 2 Sep 2005 06:19:24
> -0700.
> 
> > Hello!
> > 
> > I use PHP Mapscript 4.6.0 and I know that the
> function
> > $objMap->insertLayer is not implemented in the PHP
> > Version of MapScript.
> > Since this will be implemented in a future
> release, I
> > try to solve my problem with ms_newLayerObj(), as
> > Daniel Morissette wrote in Bug 762.
> > But I can't figure out how a function to create a
> new
> > layer can be a workaround for a function which
> adds a
> > layer to the map object.
> > The Problem is (And many others seem to be stuck
> here
> > too) that I have a mapObject with some "dummy
> layers"
> > predefined in the mapfile. Now I want to change
> the
> > tileitem and tileindex for that layers during
> runtime
> > of my PHP Script to fill the dummy layers with
> some
> > data (GDAL raster files in my case):
> > 
> > $objLayer=$objMap->GetLayerByName(<layername>);
> > $objLayer->tileitem="location";
> > $objLayer->tileindex="<mypath>/gdaltindex.shp";
> > 
> > doesn't work because the layer object lives
> outside
> > the map object. 
> > 
> > var_dump(objLayer) dumps the correct layer but a
> > var_dump($objMap->GetLayerByName(<layername>))
> returns
> > the old layer. 
> > So can somebody tell me how to create a map object
> > from a mapfile and add a "runtime-layer" to that
> > object with PHP Mapscript?
> > 
> > Thanks for any reply,
> 
> Michael,
> 
> What do you mean by 'layer object lives outside the
> map object'?
> I don't believe it does in your case because you are
> creating it via the
> mapObj.
> 
> Lowell
> 



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 



More information about the mapserver-users mailing list