<!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> </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> </DIV>
<DIV><FONT face=Arial size=2>[17-Jun-2005 09:23:21] PHP Fatal error:
[MapServer Error]: msLayerGetShape(): Invalid feature id.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </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> </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> </DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Jacob</FONT></DIV>
<DIV> </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> </DIV>
<DIV>Hi,</DIV>
<DIV> </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> </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> </DIV>
<DIV>Julien</DIV>
<DIV> </DIV>
<DIV>On 06/16/2005 03:04 AM, Jacob Delfos wrote:<BR>> Hi all,<BR>>
<BR>> Can anyone tell me if there is a way to catch the error that getShape
<BR>> throws if you request a shape that is out of range?<BR>> <BR>>
Reason is I'm trying to iterate through a layer. At this stage, I need <BR>>
to use an object count to make the loop stop. Getting an object count <BR>>
either requires me to use the shpfileobj->numshapes variable (which <BR>>
obviously only works on shapefiles), or doing a query (which would only <BR>>
work on layers with templates, which would need a reprojected rectangle,
<BR>> uses overhead, etc….).<BR>> <BR>> Would it be possible to make
getShape return MS_FAILURE if the object is <BR>> out of range, or throw a
warning that can be caught using <A href="mailto:'@'">'@'</A> error <BR>>
suppression? That way one could iterate through a whole layer without <BR>>
needing a layer count.<BR>> <BR>> Regards,<BR>> <BR>> Jacob<BR>>
<BR>> <BR>> <BR>> * *<BR>> <BR>> *JACOB DELFOS<BR>>
SPATIAL INFORMATION ANALYST<BR>> *Maunsell Australia Pty Ltd<BR>> 629
Newcastle Street, Leederville, WA 6007<BR>> <BR>> PO Box 81, Leederville,
WA 6902<BR>> <BR>> Western Australia<BR>> <BR>> ABN 20 093 846
925<BR>> <BR>> Tel + 61 8 9281 6185<BR>>
Fax + 61 8 9281 6297<BR>> <A
href="mailto:_jacob.delfos@maunsell.com">_jacob.delfos@maunsell.com</A>_<BR>>
</DIV>
<DIV> </DIV>
<DIV>--
<BR>------------------------------------------------------------<BR>Julien-Samuel
Lacroix <A
href="mailto:jlacroix@dmsolutions.ca">jlacroix@dmsolutions.ca</A><BR>DM
Solutions
Group
<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> </DIV></BODY></HTML>