mapscript error

Aaron Koning aaronkoning at GMAIL.COM
Tue Dec 12 18:25:46 EST 2006


The missing '$' for returnVal might be a problem:
     $resultCache = $overlayLayer->getResult(returnVal);

Also, if the shapefile isn't tiled, then try simplifying by using -1 as the
first argument to getShape(...).

Aaron

On 12/12/06, Ravi <ravikapoor101 at gmail.com> wrote:
>
> 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>
>



-- 
+-------------------------------------------------
|  Aaron Koning
|  Information Technologist
|  Prince George, BC, Canada.
+-------------------------------------------------
|  Flexible Internet Spatial Template:
|       http://fist-mapping.org
+-------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20061212/771978e6/attachment.html


More information about the mapserver-users mailing list