<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1498" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi Julien,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks for your suggestion. I have tried it, but it 
didn't work. I have tried using my own error handler (with set_error_handler), 
but even if I do that, my php log says:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>[17-Jun-2005 09:23:21] PHP Fatal error:&nbsp; 
[MapServer Error]: msLayerGetShape(): Invalid feature id.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I also get this when using the mapserver error 
object. I guess it's because the getShape function generates a fatal error, 
which in php will always result in script termination. </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I guess my problem is using php_mapscript_44 and 
php4. If I used php 5 I could use a "try catch" statement....</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Jacob</FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=Arial size=2>
<DIV><BR>-----Original Message-----<BR>From: Julien-Samuel Lacroix 
[mailto:jlacroix@dmsolutions.ca] <BR>Sent: 16 June 2005 23:00<BR>To: Jacob 
Delfos<BR>Cc: <A 
href="mailto:MAPSERVER-USERS@LISTS.UMN.EDU">MAPSERVER-USERS@LISTS.UMN.EDU</A><BR>Subject: 
Re: [UMN_MAPSERVER-USERS] Catching error of getShape - php_mapscript</DIV>
<DIV>&nbsp;</DIV>
<DIV>Hi,</DIV>
<DIV>&nbsp;</DIV>
<DIV>With Mapscript there's the errorObj object that can do exactly what you 
<BR>want I think. There's an example of how to use it in the doc.</DIV>
<DIV>&nbsp;</DIV>
<DIV><A 
href="http://mapserver.gis.umn.edu/doc44/phpmapscript-class-guide.html#errorobj">http://mapserver.gis.umn.edu/doc44/phpmapscript-class-guide.html#errorobj</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>Julien</DIV>
<DIV>&nbsp;</DIV>
<DIV>On 06/16/2005 03:04 AM, Jacob Delfos wrote:<BR>&gt; Hi all,<BR>&gt; 
<BR>&gt; Can anyone tell me if there is a way to catch the error that getShape 
<BR>&gt; throws if you request a shape that is out of range?<BR>&gt; <BR>&gt; 
Reason is I'm trying to iterate through a layer. At this stage, I need <BR>&gt; 
to use an object count to make the loop stop. Getting an object count <BR>&gt; 
either requires me to use the shpfileobj-&gt;numshapes variable (which <BR>&gt; 
obviously only works on shapefiles), or doing a query (which would only <BR>&gt; 
work on layers with templates, which would need a reprojected rectangle, 
<BR>&gt; uses overhead, etc….).<BR>&gt; <BR>&gt; Would it be possible to make 
getShape return MS_FAILURE if the object is <BR>&gt; out of range, or throw a 
warning that can be caught using <A href="mailto:'@'">'@'</A> error <BR>&gt; 
suppression? That way one could iterate through a whole layer without <BR>&gt; 
needing a layer count.<BR>&gt; <BR>&gt; Regards,<BR>&gt; <BR>&gt; Jacob<BR>&gt; 
<BR>&gt;&nbsp; <BR>&gt; <BR>&gt; * *<BR>&gt; <BR>&gt; *JACOB DELFOS<BR>&gt; 
SPATIAL INFORMATION ANALYST<BR>&gt; *Maunsell Australia Pty Ltd<BR>&gt; 629 
Newcastle Street, Leederville, WA 6007<BR>&gt; <BR>&gt; PO Box 81, Leederville, 
WA 6902<BR>&gt; <BR>&gt; Western Australia<BR>&gt; <BR>&gt; ABN 20 093 846 
925<BR>&gt; <BR>&gt; Tel&nbsp;&nbsp;&nbsp;&nbsp; + 61 8 9281 6185<BR>&gt; 
Fax&nbsp;&nbsp;&nbsp; + 61 8 9281 6297<BR>&gt; <A 
href="mailto:_jacob.delfos@maunsell.com">_jacob.delfos@maunsell.com</A>_<BR>&gt; 
</DIV>
<DIV>&nbsp;</DIV>
<DIV>-- 
<BR>------------------------------------------------------------<BR>Julien-Samuel 
Lacroix&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A 
href="mailto:jlacroix@dmsolutions.ca">jlacroix@dmsolutions.ca</A><BR>DM 
Solutions 
Group&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<A 
href="http://www.dmsolutions.ca/">http://www.dmsolutions.ca/</A><BR>------------------------------------------------------------<BR></FONT></DIV>
<DIV><FONT face=Arial size=2><A 
href="mailto:jacob.delfos@maunsell.com"></A></FONT>&nbsp;</DIV></BODY></HTML>