No "$objMap->insertLayer" in PHP Mapscript: OK. But where is the workaround?

Lowell Filak lfilak at MEDINACO.ORG
Fri Sep 2 09:53:10 EDT 2005


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



More information about the mapserver-users mailing list