The missing '$' for returnVal might be a problem:<br> $resultCache = $overlayLayer->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> <<a href="mailto:ravikapoor101@gmail.com">ravikapoor101@gmail.com</a>> 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><?php<br>dl("php_mapscript_4.10.0.dll");<br><br>$map =<br>ms_newMapObj("C:/ms4w/apps/us_streets2005se-1/map/us_streets2005se-1.map
");<br><br>$overlayLayer = $map->getLayerByName("countiesLayer");<br><br>$myApt = ms_newPointObj();<br>$myApt->setXY(-121.997, 37.348);<br><br>$returnVal = $overlayLayer->queryByPoint($myApt,$mapscript->MS_SINGLE,0);
<br><br>$resultCache = $overlayLayer->getResult(returnVal);<br><br>$overlayLayer->open();<br>$overlayLayer->getShape($resultCache->tileindex, $resultCache->shapeindex);<br>// I am getting error on this previous line, getShape fails.
<br>?><br><HTML><br><HEAD><br><TITLE>Show Weather On Map</TITLE><br></HEAD><br><BODY><br>mapscript version = <?php echo $resultCache->shapeindex ?><br></BODY><br></HTML>
<br></blockquote></div><br><br clear="all"><br>-- <br>+-------------------------------------------------<br>| Aaron Koning<br>| Information Technologist<br>| Prince George, BC, Canada.<br>+-------------------------------------------------
<br>| Flexible Internet Spatial Template:<br>| <a href="http://fist-mapping.org">http://fist-mapping.org</a><br>+-------------------------------------------------