The missing '$' for returnVal might be a problem:<br>&nbsp;&nbsp;&nbsp;&nbsp; $resultCache = $overlayLayer-&gt;getResult(returnVal);<br><br>Also, if the shapefile isn't tiled, then try simplifying by using -1 as the first argument to getShape(...).
<br><br>Aaron<br><br><div><span class="gmail_quote">On 12/12/06, <b class="gmail_sendername">Ravi</b> &lt;<a href="mailto:ravikapoor101@gmail.com">ravikapoor101@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi guys,<br><br>I am writing a simple mapscript. This is what I am doing:<br><br>I have a layer where I draw counties. When a user clicks on map (I have<br>the coordinates), I want to find which county it is. So I query the
<br>layer and I get one record back, so far so good. Then I call getShape<br>method for the record. Now suddenly I get the error that the record<br>number does not exist. I opened the DBF file and the record IS there.<br>
<br>Your help is appreciated. My script and error are as follows:<br><br><br>--------------------------------------------------------------------<br>Fatal error: [MapServer Error]: msDBFGetItemIndex(): Invalid record<br>number 226. in C:\ms4w\Apache\htdocs\test.php on line 16
<br>--------------------------------------------------------------------<br>&lt;?php<br>dl(&quot;php_mapscript_4.10.0.dll&quot;);<br><br>$map =<br>ms_newMapObj(&quot;C:/ms4w/apps/us_streets2005se-1/map/us_streets2005se-1.map
&quot;);<br><br>$overlayLayer = $map-&gt;getLayerByName(&quot;countiesLayer&quot;);<br><br>$myApt = ms_newPointObj();<br>$myApt-&gt;setXY(-121.997, 37.348);<br><br>$returnVal = $overlayLayer-&gt;queryByPoint($myApt,$mapscript-&gt;MS_SINGLE,0);
<br><br>$resultCache = $overlayLayer-&gt;getResult(returnVal);<br><br>$overlayLayer-&gt;open();<br>$overlayLayer-&gt;getShape($resultCache-&gt;tileindex, $resultCache-&gt;shapeindex);<br>// I am getting error on this previous line, getShape fails.
<br>?&gt;<br>&lt;HTML&gt;<br>&lt;HEAD&gt;<br>&lt;TITLE&gt;Show Weather On Map&lt;/TITLE&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>mapscript version = &lt;?php echo $resultCache-&gt;shapeindex ?&gt;<br>&lt;/BODY&gt;<br>&lt;/HTML&gt;
<br></blockquote></div><br><br clear="all"><br>-- <br>+-------------------------------------------------<br>|&nbsp;&nbsp;Aaron Koning<br>|&nbsp;&nbsp;Information Technologist<br>|&nbsp;&nbsp;Prince George, BC, Canada.<br>+-------------------------------------------------
<br>|&nbsp;&nbsp;Flexible Internet Spatial Template:<br>|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://fist-mapping.org">http://fist-mapping.org</a><br>+-------------------------------------------------