[Mapserver-users] MS 4 beta2, problems with queryByPoint andPostGIS

Yewondwossen Assefa assefa at dmsolutions.ca
Wed Jul 23 09:58:48 EDT 2003


--------------030205010007010908030007
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

I have tried thios with a test data that I had and I was woring properly 
for me. I used variable name (as well as statis text) to access the 
values of the shape.
 I do not really know what is wrong in your case (make sure that the 
field names are valid using print_r($qShape->values);

I am ccing the list in case maybe someone has the same pb/idea.

Later

Armin Burger wrote:

>Assefa,
>
>I had a look at the function that causes the problem under MS on Windows.
>
>
>The query itself is executed with
>
>$selrect = ms_newrectObj();
>$selrect->setextent($minx_sel_geo, $miny_sel_geo, $maxx_sel_geo,
>$maxy_sel_geo);
>@$queryMap->queryByRect($selrect);
>$selrect->free();
>
>
>
>I use something like the following to print out the results:
>
>1 $numResults = $qLayer->getNumResults();
>2 if ($numResults > 0) {
>3
>4    // ONE ROW IN TABLE FOR EACH RECORD
>5    for ($iRes=0; $iRes < $numResults; $iRes++) {
>6        $qRes = $qLayer->getResult($iRes);
>7        $qShape = $qLayer->getShape($qRes->tileindex,$qRes->shapeindex);
>8
>9        printf("<TR>");
>10       // Print all OTHER COLUMNS from SHAPE
>11       for ($iField=0; $iField < sizeof($selFields); $iField++) {
>12           $fldName  = $selFields[$iField];
>13           $fldValue = $qShape->values[$fldName];
>14           printf("<td>$fldValue</td>");
>15       }
>16       printf("</TR>\n");
>17
>18       $qShape->free();
>19    }
>20    $qLayer->close();
>21 }
>
>
>
>
>As I mentioned in my last mail queryByPoint works fine. I can also
>execute the 'queryByRect' and just print out the number of records. The
>errors occur only if I want to print out the values for all found records
>with the function above.
>
>When I comment out the lines 7 and 18 and in line 13 just define a fix
>string as value then everything works ok. So the 'getShape' method seems
>to cause problems for results with plenty of records. I tested it with 2
>different postgis versions, one on Linux, the other one under Win/Cygwin.
>The error occured for both.
>
>To make things even stranger, the error did *not* show up on a Linux
>system and new compiled MS from nightly build (date: 22 July) with the
>new mappostgis.c file. Here I used the same Postgis database as with the
>test on Windows.
>
>
>Armin
>
>
>
>
>
>
>  
>
>>Hi There,
>>    
>>
>
>  
>
>> I have placed a new version of php_mapscript_40.dll  (php4.3.2, latest
>>mapserver 4.0 ) at http://www2.dmsolutions.ca/tmp/php_mapscript_40.dll
>>that should correct the crah for the querybypoint. Can you give it a
>>    
>>
>try
>  
>
>>and let me know (I will put a full distribution sometimes this week on
>>the usual download site).
>> I am not sure though if It solves the second problem you mentionned
>>about "some records were not returned properly". Could you give need
>>more information on this so It will be easier  to identify the problem.
>>    
>>
>
>  
>
>>Later,
>>    
>>
>
>
>  
>
>>Armin Burger wrote:
>>    
>>
>
>  
>
>>>Hello,
>>>
>>>I wonder if anybody else ran into the same problem with the current
>>>version 4 beta2 and the PHP/Mapscript method 'queryByPoint'. Applying
>>>this method on a map object with active PostGIS layers crashes the
>>>php.exe on Windows, and under Linux one just gets a server error. A
>>>similar problem happened when using 'queryByRect'. Here PHP not always
>>>crashed but some records were not returned properly (or maybe only the
>>>last one).
>>>
>>>I tested the functions with the Win 4 beta 2 executable from 11 July
>>>(from DM Solutions) and the beta 2 tar package compiled under Linux.
>>>      
>>>
>The
>  
>
>>>version 4 beta 1 was working fine with regard to PostGIS. Any ideas
>>>      
>>>
>what
>  
>
>>>happened?
>>>
>>>Armin
>>>_______________________________________________
>>>Mapserver-users mailing list
>>>Mapserver-users at lists.gis.umn.edu
>>>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>>>
>>>
>>>
>>>      
>>>
>
>  
>
>>--
>>----------------------------------------------------------------
>>Assefa Yewondwossen
>>Software Analyst
>>    
>>
>
>  
>
>>Email: assefa at dmsolutions.ca
>>http://www.dmsolutions.ca/
>>    
>>
>
>  
>
>>Phone: (613) 565-5056 (ext 14)
>>Fax:   (613) 565-0925
>>----------------------------------------------------------------
>>    
>>
>
>
>
>
>
>
>
>  
>

-- 
----------------------------------------------------------------
Assefa Yewondwossen           
Software Analyst   

Email: assefa at dmsolutions.ca    
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------




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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body>
I have tried thios with a test data that I had and I was woring properly
for me. I used variable name (as well as statis text) to access the values
of the shape.<br>
&nbsp;I do not really know what is wrong in your case (make sure that the field
names are valid using print_r($qShape-&gt;values);<br>
<br>
I am ccing the list in case maybe someone has the same pb/idea.<br>
<br>
Later<br>
<br>
Armin Burger wrote:<br>
<blockquote type="cite"
 cite="mid20030722214222.ROXQ4247.viefep16-int.chello.at at libero.it">
  <pre wrap="">Assefa,

I had a look at the function that causes the problem under MS on Windows.


The query itself is executed with

$selrect = ms_newrectObj();
$selrect-&gt;setextent($minx_sel_geo, $miny_sel_geo, $maxx_sel_geo,
$maxy_sel_geo);
@$queryMap-&gt;queryByRect($selrect);
$selrect-&gt;free();



I use something like the following to print out the results:

1 $numResults = $qLayer-&gt;getNumResults();
2 if ($numResults &gt; 0) {
3
4    // ONE ROW IN TABLE FOR EACH RECORD
5    for ($iRes=0; $iRes &lt; $numResults; $iRes++) {
6        $qRes = $qLayer-&gt;getResult($iRes);
7        $qShape = $qLayer-&gt;getShape($qRes-&gt;tileindex,$qRes-&gt;shapeindex);
8
9        printf("&lt;TR&gt;");
10       // Print all OTHER COLUMNS from SHAPE
11       for ($iField=0; $iField &lt; sizeof($selFields); $iField++) {
12           $fldName  = $selFields[$iField];
13           $fldValue = $qShape-&gt;values[$fldName];
14           printf("&lt;td&gt;$fldValue&lt;/td&gt;");
15       }
16       printf("&lt;/TR&gt;\n");
17
18       $qShape-&gt;free();
19    }
20    $qLayer-&gt;close();
21 }




As I mentioned in my last mail queryByPoint works fine. I can also
execute the 'queryByRect' and just print out the number of records. The
errors occur only if I want to print out the values for all found records
with the function above.

When I comment out the lines 7 and 18 and in line 13 just define a fix
string as value then everything works ok. So the 'getShape' method seems
to cause problems for results with plenty of records. I tested it with 2
different postgis versions, one on Linux, the other one under Win/Cygwin.
The error occured for both.

To make things even stranger, the error did *not* show up on a Linux
system and new compiled MS from nightly build (date: 22 July) with the
new mappostgis.c file. Here I used the same Postgis database as with the
test on Windows.


Armin






  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi There,
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap=""> I have placed a new version of php_mapscript_40.dll  (php4.3.2, latest
mapserver 4.0 ) at <a class="moz-txt-link-freetext" href="http://www2.dmsolutions.ca/tmp/php_mapscript_40.dll">http://www2.dmsolutions.ca/tmp/php_mapscript_40.dll</a>
that should correct the crah for the querybypoint. Can you give it a
    </pre>
  </blockquote>
  <pre wrap=""><!---->try
  </pre>
  <blockquote type="cite">
    <pre wrap="">and let me know (I will put a full distribution sometimes this week on
the usual download site).
 I am not sure though if It solves the second problem you mentionned
about "some records were not returned properly". Could you give need
more information on this so It will be easier  to identify the problem.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap="">Later,
    </pre>
  </blockquote>
  <pre wrap=""><!---->

  </pre>
  <blockquote type="cite">
    <pre wrap="">Armin Burger wrote:
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">Hello,

I wonder if anybody else ran into the same problem with the current
version 4 beta2 and the PHP/Mapscript method 'queryByPoint'. Applying
this method on a map object with active PostGIS layers crashes the
php.exe on Windows, and under Linux one just gets a server error. A
similar problem happened when using 'queryByRect'. Here PHP not always
crashed but some records were not returned properly (or maybe only the
last one).

I tested the functions with the Win 4 beta 2 executable from 11 July
(from DM Solutions) and the beta 2 tar package compiled under Linux.
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->The
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">version 4 beta 1 was working fine with regard to PostGIS. Any ideas
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->what
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">happened?

Armin
_______________________________________________
Mapserver-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Mapserver-users at lists.gis.umn.edu">Mapserver-users at lists.gis.umn.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.gis.umn.edu/mailman/listinfo/mapserver-users">http://lists.gis.umn.edu/mailman/listinfo/mapserver-users</a>



      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap="">--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap="">Email: <a class="moz-txt-link-abbreviated" href="mailto:assefa at dmsolutions.ca">assefa at dmsolutions.ca</a>
<a class="moz-txt-link-freetext" href="http://www.dmsolutions.ca/">http://www.dmsolutions.ca/</a>
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <blockquote type="cite">
    <pre wrap="">Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------
    </pre>
  </blockquote>
  <pre wrap=""><!---->






  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="$mailwrapcol">-- 
----------------------------------------------------------------
Assefa Yewondwossen           
Software Analyst   

Email: <a class="moz-txt-link-abbreviated" href="mailto:assefa at dmsolutions.ca">assefa at dmsolutions.ca</a>    
<a class="moz-txt-link-freetext" href="http://www.dmsolutions.ca/">http://www.dmsolutions.ca/</a>

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------

</pre>
<br>
</body>
</html>

--------------030205010007010908030007--





More information about the mapserver-users mailing list