[mapserver-users] getLayer()

Assefa Yewondwossen assefa at dmsolutions.ca
Wed May 29 11:11:58 EDT 2002


Hi There,

If you use the funcion getLayerByName, you should give as an argument the name of the
layer. Something like :

 $layer=$map->getLayerByName("mun"); and not the index of the layer
(getLayerByName(1)).

Later,

Manuel Marichal Pérez wrote:

>         Hi all. I'm having problems obtaining a layer. In my map, I've got only
>         two layers (one named "gc" and another one named "mun"). I can obtain
>         the name of the first layer doing:
>
>         <?
>         dl('php_mapscript_34.dll');
>
>         $path="c:\\inetpub\\wwwroot\\hristo2\\";
>         $map = ms_newMapObj($path."hristo.map");
>         $layer=$map->getLayer(0);                       <<----- The first layer
>         $foo=$layer->name;
>         ?>
>
>         If I print '$layer->name' I obtain "gc". Good. But if I try to obtain the
> name
>         of the second layer, impredictable results are shown:
>
>         <?
>         dl('php_mapscript_34.dll');
>
>         $path="c:\\inetpub\\wwwroot\\hristo2\\";
>         $map = ms_newMapObj($path."hristo.map");
>         $layer=$map->getLayerByName(1);         <<----- Now the second one
>         $foo=$layer->name;
>         ?>
>
>         If I try this, obtain only "non-printable" characters in '$layer->name'. It
> seems
>         not to have obtain the layer properly. ¿...?.
>
>         What's the problem???
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com

--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------





More information about the mapserver-users mailing list