mapscript error
Ravi
ravikapoor101 at GMAIL.COM
Tue Dec 12 12:42:55 PST 2006
Hi guys,
I am writing a simple mapscript. This is what I am doing:
I have a layer where I draw counties. When a user clicks on map (I have
the coordinates), I want to find which county it is. So I query the
layer and I get one record back, so far so good. Then I call getShape
method for the record. Now suddenly I get the error that the record
number does not exist. I opened the DBF file and the record IS there.
Your help is appreciated. My script and error are as follows:
--------------------------------------------------------------------
Fatal error: [MapServer Error]: msDBFGetItemIndex(): Invalid record
number 226. in C:\ms4w\Apache\htdocs\test.php on line 16
--------------------------------------------------------------------
<?php
dl("php_mapscript_4.10.0.dll");
$map =
ms_newMapObj("C:/ms4w/apps/us_streets2005se-1/map/us_streets2005se-1.map");
$overlayLayer = $map->getLayerByName("countiesLayer");
$myApt = ms_newPointObj();
$myApt->setXY(-121.997, 37.348);
$returnVal = $overlayLayer->queryByPoint($myApt,$mapscript->MS_SINGLE,0);
$resultCache = $overlayLayer->getResult(returnVal);
$overlayLayer->open();
$overlayLayer->getShape($resultCache->tileindex, $resultCache->shapeindex);
// I am getting error on this previous line, getShape fails.
?>
<HTML>
<HEAD>
<TITLE>Show Weather On Map</TITLE>
</HEAD>
<BODY>
mapscript version = <?php echo $resultCache->shapeindex ?>
</BODY>
</HTML>
More information about the MapServer-users
mailing list