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

Michael H ärtel haerta at YAHOO.COM
Fri Sep 2 09:19:24 EDT 2005


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


		
__________________________________ 
Yahoo! Mail for Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 



More information about the mapserver-users mailing list