[mapserver-users]: wrong results querybypoint

Lowell.Filak lfilak at medinaco.org
Tue Mar 26 05:24:58 PST 2002


Try adding 1 to the result during the dbase query. The shape index starts
at 0 but the dbase file records start at 1. Hopefully that should give you
the correct result.
Lowell F.

 On Tue, 26 Mar 2002, Peter wrote:

> Hi Listers,
>
> doing a querybypoint the zoom to the queried polygon is doing well, but
> the information is wrong. It gives the wrong result. Here's the code:
>
> Thanks a lot
>
>
> Peter
>
>
>  $queryresult = @$map -> queryByPoint ($querypoint, MS_SINGLE, -1);
>
>
>   if ($queryresult == MS_SUCCESS) {
>
>     /* Bei einem Erfolg: Ergebnisse aus dem gewünschten Layer holen*/
>     $resultlayer = $map -> getLayerByName ('objekte');
>
> /* Uns interessiert nur das erste (i.e. nullte) Resultat */
>     $theresult = $resultlayer -> getResult (0);
>     $shapefile = ms_newShapefileObj ('C:\Programme\Apache
> Group\Apache\htdocs\immogis3w\code\data\objekte', -1);
>     $resultshape = $shapefile -> getShape ($theresult -> shapeindex);
>     $resultbounds = $resultshape -> bounds;
>
>
>
>     /* Karte auf diese Extents zoomen */
>     $map -> setExtent ($resultbounds -> minx-80, $resultbounds ->
> miny-80,$resultbounds -> maxx+80, $resultbounds -> maxy+80); = CORRECT
> ZOOM!!!
>     $resultlayer = $map -> getLayerByName ('objekte');
>     $numresults = $resultlayer -> getNumResults ();
>     $theresult = $resultlayer -> getResult (0);
>     $resultclass = $resultlayer -> getClass (0);
>
>     $dbasefile = dbase_open ("C:\Programme\Apache
> Group\Apache\htdocs\immogis3w\code\data\objekte.dbf", 0);
>     $dbrecord = dbase_get_record_with_names ($dbasefile, $theresult ->
> shapeindex);
>     $Dummy = $dbrecord['ID'];
>     printf ("%f<br>", $Dummy);  = WRONG RESULT!!!
>
>
>
>




More information about the MapServer-users mailing list