[mapserver-users]: SUM wrong results querybypoint

Peter blackmail@snafu.de
Tue, 26 Mar 2002 14:37:23 +0100


--------------010000070506060804050604
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

  Hi Lowell,

that was that!

the code working is:
$dbrecord = dbase_get_record_with_names ($dbasefile, $theresult -> 
shapeindex+1);


The list rocks!!! Thanks a lot!


Peter



Lowell.Filak wrote:

>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 */
>>    $ma
>>p -> 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!!!
>>
>>
>>
>>
>
>



--------------010000070506060804050604
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<html>
<head>
</head>
<body>
   Hi Lowell,<br>
<br>
 that was that!<br>
<br>
 the code working is:<br>
 $dbrecord = dbase_get_record_with_names ($dbasefile, $theresult -&gt; shapeindex+1);<br>
<br>
<br>
 The list rocks!!! Thanks a lot!<br>
<br>
<br>
 Peter<br>
<br>
<br>
<br>
 Lowell.Filak wrote:<br>
<blockquote type="cite" cite="mid:Pine.LNX.4.33.0203260823330.13020-100000@yogi.medinaco.net">
  <pre wrap="">Try adding 1 to the result during the dbase query. The shape index starts<br>at 0 but the dbase file records start at 1. Hopefully that should give you<br>the correct result.<br>Lowell F.<br><br> On Tue, 26 Mar 2002, Peter wrote:<br><br></pre>
  <blockquote type="cite">
    <pre wrap="">Hi Listers,<br><br>doing a querybypoint the zoom to the queried polygon is doing well, but<br>the information is wrong. It gives the wrong result. Here's the code:<br><br>Thanks a lot<br><br><br>Peter<br><br><br> $queryresult = @$map -&gt; queryByPoint ($querypoint, MS_SINGLE, -1);<br><br><br>  if ($queryresult == MS_SUCCESS) {<br><br>    /* Bei einem Erfolg: Ergebnisse aus dem gew&uuml;nschten Layer holen*/<br>    $resultlayer = $map -&gt; getLayerByName ('objekte');<br><br>/* Uns interessiert nur das erste (i.e. nullte) Resultat */<br>    $theresult = $resultlayer -&gt; getResult (0);<br>    $shapefile = ms_newShapefileObj ('<a class="moz-txt-link-freetext" href="C:%5CProgramme%5CApache">C:\Programme\Apache</a><br>Group\Apache\htdocs\immogis3w\code\data\objekte', -1);<br>    $resultshape = $shapefile -&gt; getShape ($theresult -&gt; shapeindex);<br>    $resultbounds = $resultshape -&gt; bounds;<br><br><br><br>    /* Karte auf diese Extents zoomen */<br>   
 $ma
p -&gt; setExtent ($resultbounds -&gt; minx-80, $resultbounds -&gt;<br>miny-80,$resultbounds -&gt; maxx+80, $resultbounds -&gt; maxy+80); = CORRECT<br>ZOOM!!!<br>    $resultlayer = $map -&gt; getLayerByName ('objekte');<br>    $numresults = $resultlayer -&gt; getNumResults ();<br>    $theresult = $resultlayer -&gt; getResult (0);<br>    $resultclass = $resultlayer -&gt; getClass (0);<br><br>    $dbasefile = dbase_open ("<a class="moz-txt-link-freetext" href="C:%5CProgramme%5CApache">C:\Programme\Apache</a><br>Group\Apache\htdocs\immogis3w\code\data\objekte.dbf", 0);<br>    $dbrecord = dbase_get_record_with_names ($dbasefile, $theresult -&gt;<br>shapeindex);<br>    $Dummy = $dbrecord['ID'];<br>    printf ("%f&lt;br&gt;", $Dummy);  = WRONG RESULT!!!<br><br><br><br><br></pre>
    </blockquote>
    <pre wrap=""><!----><br><br></pre>
    </blockquote>
    <br>
    <br>
    </body>
    </html>

--------------010000070506060804050604--