PHP Mapscript getLayerByName

Yewondwossen Assefa assefa at DMSOLUTIONS.CA
Fri Jan 28 07:16:24 PST 2005


Hi There,

  The php waring generated can be supressed using a @ (something like
@$oLayer = $oMap->getLayerByName("notvalidlayer");) and then you can
validate the value of $oLayer.   Is this accepatable ?

  In my opnion, the default behaviour of generating a php waring is ok
since It can be suppressed for those would do not want the warnings. I
agree It should make it to the docs but I guess most (maybe all) of the
wranings gnerated are not documented so If it is done It must be done
for all. Another point is that we haven't be very consistent or defined
a clear guide line on what type of error a function is suppose to return
   for diffrent scenarios. There is a need to revisit this at one point
and have the warings/erros consistent through all the mapscript flavors
but then again It is a long process to pass through all the functions.

I have updated bug 1184 with this info.

Later,


Godwin, Elizabeth wrote:

> Hello,
>
> I've been trying to use getLayerByName function and it's returning a
> warning when I use it.  I just want to verify if I am doing something
> wrong, before I file a bug, if it's a bug.  I've tried this on 4.2,
> 4.4 and CVS from a week ago, all yield the same warning.
>
>  From what I understand, the function returns the layer object if it
> finds the layer, and FALSE if it doesn't.  I'm getting FALSE *AND* a
> warning message.
>
> _code snippit:_
>
> //returns the layer object ok.
> $oLayer = $oMap->getLayerByName("validlayername");
>
> //retuns FALSE and error
> $oLayer = $oMap->getLayerByName("notvalidlayer");
>
>  *Warning*: getLayerByName failed for : notvalidlayer in ...
>
> Thanks,
>
> Liz Godwin


--
----------------------------------------------------------------
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