<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Comic Sans MS";
        panose-1:3 15 7 2 3 3 2 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
tt
        {font-family:"Courier New";}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Comic Sans MS";
        color:blue;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'>I&#8217;m just
a MapServer user.&nbsp; I&#8217;ve copied this reply to the list so your comments
will be seen.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'>Worth<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=blue face="Comic Sans MS"><span
style='font-size:12.0pt;font-family:"Comic Sans MS";color:blue'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Cristiano
Sumariva [mailto:sumariva@gmail.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Monday, March 29, 2010 7:28
AM<br>
<b><span style='font-weight:bold'>To:</span></b> Worth Lutz<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [mapserver-users] php
mapscript</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>To me would be very good
that mapserver documentation includes a since version.subversion.release flag
at documentation function names like php does on their site.<br>
<br>
And for those changes and breaks on code the user contribution on end of
function descriptions would be welcome too.<br>
<br>
Example from php<br>
<br>
pg_connect<br>
(PHP 4, PHP 5)<br>
<span class=type>resource</span> <span class=methodname><b><span
style='font-weight:bold'>pg_connect</span></b></span> ( <span class=type>string</span><span
class=methodparam> </span></span></font><tt><font size=2 face="Courier New"><span
style='font-size:10.0pt'>$connection_string</span></font></tt> )<br>
<br>
<a href="http://br2.php.net/manual/en/function.pg-connect.php">http://br2.php.net/manual/en/function.pg-connect.php</a><o:p></o:p></p>

<div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>2010/3/29 Worth Lutz &lt;<a href="mailto:wal3@mindspring.com">wal3@mindspring.com</a>&gt;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>I don't think that the documentation has caught up with the changes in
the<br>
program. &nbsp;People using older versions of MapServer have to use the older<br>
method and the new method is used for 5.6+ version. &nbsp;It was described<br>
briefly in the migration document but took me some experimentation to get<br>
results.<br>
<br>
Worth<br>
<br>
-----Original Message-----<br>
From: Sven Schroeter [mailto:<a href="mailto:schroeter@netgis.de">schroeter@netgis.de</a>]<br>
Sent: Monday, March 29, 2010 4:18 AM<br>
To: Worth Lutz<br>
Cc: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
Subject: Re: [mapserver-users] php mapscript<br>
<br>
Hi,<br>
thank you very much, shapeObj resultsGetShape is the solution.<br>
resultsGetShape works fine.<br>
But I don't understand why shapeObj getFeature is in the documentation?<br>
<br>
Sven<br>
<br>
<br>
----- Original Message -----<br>
From: Worth Lutz<br>
To: 'Sven Schroeter' ;<br>
Sent: Friday, March 26, 2010 11:09 PM<br>
Subject: RE: [mapserver-users] php mapscript<br>
<br>
<br>
This problem is due to the new single pass query in 5.6.<br>
<br>
I have marked your code with what I am using.<br>
<br>
Try these mods marked with &quot;*************************&quot;:<br>
<br>
<br>
@$datQuery = $query_layer-&gt;queryByRect($qRect);<br>
<br>
&nbsp;//number of objects<br>
&nbsp;$resnum = $query_layer-&gt;getNumResults(); &nbsp;echo &quot;number of
objects:<br>
&quot;.$resnum.&quot;&lt;br&gt;&quot;;<br>
<br>
&nbsp;//if query success<br>
if ($datQuery == MS_SUCCESS) {<br>
// &nbsp;$query_layer-&gt;open(); &nbsp; &nbsp; &nbsp;// &lt;&lt;REMOVE OPEN
AND CLOSE ***********<br>
<br>
&nbsp;//first row<br>
&nbsp;$result = $query_layer-&gt;getResult(0);<br>
<br>
<br>
&nbsp;//$shpobj =<br>
$query_layer-&gt;getShape($result-&gt;tileindex,$result-&gt;shapeindex);<br>
&nbsp;// resultsGetShape is now the way to get the shape object<br>
***************************<br>
&nbsp;// note: change of order in arguments<br>
************************************************<br>
&nbsp;$shpobj = $query_layer-&gt;resultsGetShape($result-&gt;shapeindex,<br>
$result-&gt;tileindex);<br>
<br>
<br>
&nbsp;//read attribute<br>
&nbsp;$attr = $shpobj-&gt;values;<br>
<br>
&nbsp;//write headline<br>
&nbsp;echo '&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;2&quot;
border=&quot;1&quot; &gt;&lt;tr&gt;';<br>
&nbsp;foreach($attr as $name=&gt;$wert) {<br>
&nbsp; echo '&lt;td bgcolor=&quot;#CCCCCC&quot;&gt;'.$name.'&lt;/td&gt;';<br>
&nbsp;}<br>
&nbsp;echo '&lt;/tr&gt;';<br>
<br>
&nbsp;//write datasets<br>
&nbsp;for ($j=0; $j&lt;$query_layer-&gt;getNumResults(); $j++) {<br>
&nbsp; $result = $query_layer-&gt;getResult($j);<br>
<br>
<br>
&nbsp; //$shpobj =<br>
$query_layer-&gt;getShape($result-&gt;tileindex,$result-&gt;shapeindex);<br>
&nbsp; // see note above<br>
**********************************************************************<br>
&nbsp; $shpobj = $query_layer-&gt;resultsGetShape($result-&gt;shapeindex,<br>
$result-&gt;tileindex);<br>
<br>
<br>
&nbsp; $ri = $result-&gt;tileindex;<br>
&nbsp; $si = $result-&gt;shapeindex;<br>
&nbsp; $attr = $shpobj-&gt;values;<br>
&nbsp; echo '&lt;tr id=&quot;row'.$si.'&quot; &gt;';<br>
&nbsp; foreach($attr as $name=&gt;$wert) {<br>
&nbsp; &nbsp;echo '&lt;td&gt;'.$wert.'&lt;/td&gt;';<br>
&nbsp; }<br>
&nbsp; echo '&lt;/tr&gt;';<br>
&nbsp; $shpobj-&gt;free();<br>
&nbsp;}<br>
// &nbsp;$query_layer-&gt;close(); &nbsp; &nbsp; &nbsp;// &lt;&lt;REMOVE OPEN
AND CLOSE ***********<br>
&nbsp;echo '&lt;/table&gt;';<br>
<br>
} // end success<br>
...<br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a><br>
[mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a>]
On Behalf Of Sven Schroeter<br>
Sent: Thursday, March 25, 2010 10:52 AM<br>
To: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
Subject: Re: [mapserver-users] php mapscript<br>
<br>
Alan,<br>
thanks for the reply, I tried it with getFeature(), but there comes the same<br>
error.<br>
nextShape() works only after msWhichShapes and here I need a rectobj.<br>
But I want to use the script for queryByShape and queryByAttributes too.<br>
Why there comes no array in $attr = $shpobj-&gt;values; ?<br>
Any idea?<br>
Sven<br>
<br>
----- Original Message -----<br>
From: &quot;Alan Boudreault&quot; &lt;<a href="mailto:aboudreault@mapgears.com">aboudreault@mapgears.com</a>&gt;<br>
To: &lt;<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>&gt;<br>
Cc: &quot;Sven Schroeter&quot; &lt;<a href="mailto:schroeter@netgis.de">schroeter@netgis.de</a>&gt;<br>
Sent: Thursday, March 25, 2010 2:32 PM<br>
Subject: Re: [mapserver-users] php mapscript<br>
<br>
<br>
&gt; Sven,<br>
&gt;<br>
&gt; getShape() is deprecated. Use rather getFeature(). I suggest to also take<br>
&gt; a<br>
&gt; look at the nextShape() function:<br>
&gt; <a href="http://mapserver.org/mapscript/php/index.html#layerobj-class"
target="_blank">http://mapserver.org/mapscript/php/index.html#layerobj-class</a><br>
&gt;<br>
&gt; Alan<br>
&gt;<br>
&gt; On March 25, 2010 09:18:50 am Sven Schroeter wrote:<br>
&gt;&gt; Hi,<br>
&gt;&gt; I have an old php mapscript code that works fine with mapserver 5.02
or<br>
&gt;&gt; &nbsp;5.2, but not with 5.6.1.<br>
&gt;&gt; The code runs an attribute tabe from a postgis layer and different
querys<br>
&gt;&gt; i.e. queryByRect:<br>
&gt;&gt;<br>
&gt;&gt; ...<br>
&gt;&gt; @$datQuery = $query_layer-&gt;queryByRect($qRect);<br>
&gt;&gt;<br>
&gt;&gt; &nbsp;//number of objects<br>
&gt;&gt; &nbsp;$resnum = $query_layer-&gt;getNumResults();<br>
&gt;&gt; &nbsp;echo &quot;number of objects:
&quot;.$resnum.&quot;&lt;br&gt;&quot;;<br>
&gt;&gt;<br>
&gt;&gt; &nbsp;//if query success<br>
&gt;&gt; if ($datQuery == MS_SUCCESS) {<br>
&gt;&gt; &nbsp; $query_layer-&gt;open();<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; //first row<br>
&gt;&gt; &nbsp; $result = $query_layer-&gt;getResult(0);<br>
&gt;&gt; &nbsp; $shpobj =<br>
&gt;&gt; $query_layer-&gt;getShape($result-&gt;tileindex,$result-&gt;shapeindex);<br>
&gt;&gt; &nbsp; //read attribute<br>
&gt;&gt; &nbsp; $attr = $shpobj-&gt;values;<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; //write headline<br>
&gt;&gt; &nbsp; echo '&lt;table cellspacing=&quot;0&quot;
cellpadding=&quot;2&quot; border=&quot;1&quot; &gt;&lt;tr&gt;';<br>
&gt;&gt; &nbsp; foreach($attr as $name=&gt;$wert) {<br>
&gt;&gt; &nbsp; &nbsp;echo '&lt;td bgcolor=&quot;#CCCCCC&quot;&gt;'.$name.'&lt;/td&gt;';<br>
&gt;&gt; &nbsp; }<br>
&gt;&gt; &nbsp; echo '&lt;/tr&gt;';<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; //write datasets<br>
&gt;&gt; &nbsp; for ($j=0; $j&lt;$query_layer-&gt;getNumResults(); $j++) {<br>
&gt;&gt; &nbsp; &nbsp;$result = $query_layer-&gt;getResult($j);<br>
&gt;&gt; &nbsp; &nbsp;$shpobj =<br>
&gt;&gt; &nbsp;$query_layer-&gt;getShape($result-&gt;tileindex,$result-&gt;shapeindex);
$ri =<br>
&gt;&gt; &nbsp;$result-&gt;tileindex;<br>
&gt;&gt; &nbsp; &nbsp;$si = $result-&gt;shapeindex;<br>
&gt;&gt; &nbsp; &nbsp;$attr = $shpobj-&gt;values;<br>
&gt;&gt; &nbsp; &nbsp;echo '&lt;tr id=&quot;row'.$si.'&quot; &gt;';<br>
&gt;&gt; &nbsp; &nbsp;foreach($attr as $name=&gt;$wert) {<br>
&gt;&gt; &nbsp; &nbsp; echo '&lt;td&gt;'.$wert.'&lt;/td&gt;';<br>
&gt;&gt; &nbsp; &nbsp;}<br>
&gt;&gt; &nbsp; &nbsp;echo '&lt;/tr&gt;';<br>
&gt;&gt; &nbsp; &nbsp;$shpobj-&gt;free();<br>
&gt;&gt; &nbsp; }<br>
&gt;&gt; &nbsp; $query_layer-&gt;close();<br>
&gt;&gt; &nbsp; echo '&lt;/table&gt;';<br>
&gt;&gt;<br>
&gt;&gt; } // end success<br>
&gt;&gt; ...<br>
&gt;&gt;<br>
&gt;&gt; In ms 5.6.1 the query is also successful (I get the correct number of<br>
&gt;&gt; objects) but there comes following warning:<br>
&gt;&gt; Invalid argument supplied for foreach() in ... Fatal error: Call to a<br>
&gt;&gt; &nbsp;member function free() on a non-object in ...<br>
&gt;&gt; No object? Why? What has changed?<br>
&gt;&gt; Thanks<br>
&gt;&gt; Sven<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; mapserver-users mailing list<br>
&gt;&gt; <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
&gt;&gt; <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
&gt;&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Alan Boudreault<br>
&gt; Mapgears<br>
&gt; <a href="http://www.mapgears.com" target="_blank">http://www.mapgears.com</a><br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br>
<br>
<br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>