Hi Ravi,<br /><br />I think error is in <br />&nbsp;&nbsp;&nbsp;
$returnVal =
$overlayLayer-&gt;queryByPoint($myApt,$mapscript-&gt;MS_SINGLE,0);<br
/>&nbsp;&nbsp;&nbsp; $resultCache =
$overlayLayer-&gt;getResult(returnVal);<br />because the method
queryByPoint returns MS_SUCCESS or MS_FAILURE, not the index of shape.<br
/><br />You must:<br />&nbsp;&nbsp;&nbsp; $returnVal =
$overlayLayer-&gt;queryByPoint($myApt,$mapscript-&gt;MS_SINGLE,0);<br
/>&nbsp;&nbsp;&nbsp; $numberOfResults =
$overlayLayer-&gt;getNumResults;<br />&nbsp;&nbsp;&nbsp;
$overlayLayer-&gt;open();<br />&nbsp;&nbsp;&nbsp; for
($i=0;$i&lt;$numberOfResults;$i++) {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 
$resultCache = $overlayLayer-&gt;getResult($i);<br />&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;  $shapeObj =
$overlayLayer-&gt;getShape($resultCache-&gt;tileindex,$resultCache-&gt;shapeindex);<br
/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  /* some code with $shapeObj<br
/>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;  ...<br
/> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; 
...<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  */<br />&nbsp;&nbsp;&nbsp; }<br
/>&nbsp;&nbsp;&nbsp; $overlayLayer-&gt;close();<br /><br />let me know<br
/>Pietro<br /><br />PS:<br />Maybe you can help me:<br />how do you get
the map coordinates of a user's click? (not pixel, cartographic
coordinates).<br />thanks
<pre class="literal-block"><br />-- <br />Pietro Giannini<br />Bytewise
srl - Area GIS<br />41&deg;50'38.58&quot;N 12&deg;29'13.39&quot;E</pre>
<br /><br />On Mar, 12 Dicembre 2006 9:42 pm, Ravi wrote:<br />&gt; Hi
guys,<br />&gt; <br />&gt; I am writing a simple mapscript. This is what I
am doing:<br />&gt; <br />&gt; I have a layer where I draw counties. When
a user clicks on map (I have<br />&gt; the coordinates), I want to find
which county it is. So I query the<br />&gt; layer and I get one record
back, so far so good. Then I call getShape<br />&gt; method for the
record. Now suddenly I get the error that the record<br />&gt; number does
not exist. I opened the DBF file and the record IS there.<br />&gt; <br
/>&gt; Your help is appreciated. My script and error are as follows:<br
/>&gt; <br />&gt; <br />&gt;
--------------------------------------------------------------------<br
/>&gt; Fatal error: [MapServer Error]: msDBFGetItemIndex(): Invalid
record<br />&gt; number 226. in C:\ms4w\Apache\htdocs\test.php on line
16<br />&gt;
--------------------------------------------------------------------<br
/>&gt; &lt;?php<br />&gt; dl(&quot;php_mapscript_4.10.0.dll&quot;);<br
/>&gt; <br />&gt; $map =<br />&gt;
ms_newMapObj(&quot;C:/ms4w/apps/us_streets2005se-1/map/us_streets2005se-1.map&quot;);<br
/>&gt; <br />&gt; $overlayLayer =
$map-&gt;getLayerByName(&quot;countiesLayer&quot;);<br />&gt; <br />&gt;
$myApt = ms_newPointObj();<br />&gt; $myApt-&gt;setXY(-121.997,
37.348);<br />&gt; <br />&gt; $returnVal =
$overlayLayer-&gt;queryByPoint($myApt,$mapscript-&gt;MS_SINGLE,0);<br
/>&gt; <br />&gt; $resultCache =
$overlayLayer-&gt;getResult(returnVal);<br />&gt; <br />&gt;
$overlayLayer-&gt;open();<br />&gt;
$overlayLayer-&gt;getShape($resultCache-&gt;tileindex,<br />&gt;
$resultCache-&gt;shapeindex);<br />&gt; // I am getting error on this
previous line, getShape fails.<br />&gt; ?&gt;<br />&gt; &lt;HTML&gt;<br
/>&gt; &lt;HEAD&gt;<br />&gt; &lt;TITLE&gt;Show Weather On
Map&lt;/TITLE&gt;<br />&gt; &lt;/HEAD&gt;<br />&gt; &lt;BODY&gt;<br />&gt;
mapscript version = &lt;?php echo $resultCache-&gt;shapeindex ?&gt;<br
/>&gt; &lt;/BODY&gt;<br />&gt; &lt;/HTML&gt;<br />&gt; <br /><br /><br />