<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’m just
a MapServer user. I’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> </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> </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> </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 <<a href="mailto:wal3@mindspring.com">wal3@mindspring.com</a>><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. People using older versions of MapServer have to use the older<br>
method and the new method is used for 5.6+ version. 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 "*************************":<br>
<br>
<br>
@$datQuery = $query_layer->queryByRect($qRect);<br>
<br>
//number of objects<br>
$resnum = $query_layer->getNumResults(); echo "number of
objects:<br>
".$resnum."<br>";<br>
<br>
//if query success<br>
if ($datQuery == MS_SUCCESS) {<br>
// $query_layer->open(); // <<REMOVE OPEN
AND CLOSE ***********<br>
<br>
//first row<br>
$result = $query_layer->getResult(0);<br>
<br>
<br>
//$shpobj =<br>
$query_layer->getShape($result->tileindex,$result->shapeindex);<br>
// resultsGetShape is now the way to get the shape object<br>
***************************<br>
// note: change of order in arguments<br>
************************************************<br>
$shpobj = $query_layer->resultsGetShape($result->shapeindex,<br>
$result->tileindex);<br>
<br>
<br>
//read attribute<br>
$attr = $shpobj->values;<br>
<br>
//write headline<br>
echo '<table cellspacing="0" cellpadding="2"
border="1" ><tr>';<br>
foreach($attr as $name=>$wert) {<br>
echo '<td bgcolor="#CCCCCC">'.$name.'</td>';<br>
}<br>
echo '</tr>';<br>
<br>
//write datasets<br>
for ($j=0; $j<$query_layer->getNumResults(); $j++) {<br>
$result = $query_layer->getResult($j);<br>
<br>
<br>
//$shpobj =<br>
$query_layer->getShape($result->tileindex,$result->shapeindex);<br>
// see note above<br>
**********************************************************************<br>
$shpobj = $query_layer->resultsGetShape($result->shapeindex,<br>
$result->tileindex);<br>
<br>
<br>
$ri = $result->tileindex;<br>
$si = $result->shapeindex;<br>
$attr = $shpobj->values;<br>
echo '<tr id="row'.$si.'" >';<br>
foreach($attr as $name=>$wert) {<br>
echo '<td>'.$wert.'</td>';<br>
}<br>
echo '</tr>';<br>
$shpobj->free();<br>
}<br>
// $query_layer->close(); // <<REMOVE OPEN
AND CLOSE ***********<br>
echo '</table>';<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->values; ?<br>
Any idea?<br>
Sven<br>
<br>
----- Original Message -----<br>
From: "Alan Boudreault" <<a href="mailto:aboudreault@mapgears.com">aboudreault@mapgears.com</a>><br>
To: <<a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>><br>
Cc: "Sven Schroeter" <<a href="mailto:schroeter@netgis.de">schroeter@netgis.de</a>><br>
Sent: Thursday, March 25, 2010 2:32 PM<br>
Subject: Re: [mapserver-users] php mapscript<br>
<br>
<br>
> Sven,<br>
><br>
> getShape() is deprecated. Use rather getFeature(). I suggest to also take<br>
> a<br>
> look at the nextShape() function:<br>
> <a href="http://mapserver.org/mapscript/php/index.html#layerobj-class"
target="_blank">http://mapserver.org/mapscript/php/index.html#layerobj-class</a><br>
><br>
> Alan<br>
><br>
> On March 25, 2010 09:18:50 am Sven Schroeter wrote:<br>
>> Hi,<br>
>> I have an old php mapscript code that works fine with mapserver 5.02
or<br>
>> 5.2, but not with 5.6.1.<br>
>> The code runs an attribute tabe from a postgis layer and different
querys<br>
>> i.e. queryByRect:<br>
>><br>
>> ...<br>
>> @$datQuery = $query_layer->queryByRect($qRect);<br>
>><br>
>> //number of objects<br>
>> $resnum = $query_layer->getNumResults();<br>
>> echo "number of objects:
".$resnum."<br>";<br>
>><br>
>> //if query success<br>
>> if ($datQuery == MS_SUCCESS) {<br>
>> $query_layer->open();<br>
>><br>
>> //first row<br>
>> $result = $query_layer->getResult(0);<br>
>> $shpobj =<br>
>> $query_layer->getShape($result->tileindex,$result->shapeindex);<br>
>> //read attribute<br>
>> $attr = $shpobj->values;<br>
>><br>
>> //write headline<br>
>> echo '<table cellspacing="0"
cellpadding="2" border="1" ><tr>';<br>
>> foreach($attr as $name=>$wert) {<br>
>> echo '<td bgcolor="#CCCCCC">'.$name.'</td>';<br>
>> }<br>
>> echo '</tr>';<br>
>><br>
>> //write datasets<br>
>> for ($j=0; $j<$query_layer->getNumResults(); $j++) {<br>
>> $result = $query_layer->getResult($j);<br>
>> $shpobj =<br>
>> $query_layer->getShape($result->tileindex,$result->shapeindex);
$ri =<br>
>> $result->tileindex;<br>
>> $si = $result->shapeindex;<br>
>> $attr = $shpobj->values;<br>
>> echo '<tr id="row'.$si.'" >';<br>
>> foreach($attr as $name=>$wert) {<br>
>> echo '<td>'.$wert.'</td>';<br>
>> }<br>
>> echo '</tr>';<br>
>> $shpobj->free();<br>
>> }<br>
>> $query_layer->close();<br>
>> echo '</table>';<br>
>><br>
>> } // end success<br>
>> ...<br>
>><br>
>> In ms 5.6.1 the query is also successful (I get the correct number of<br>
>> objects) but there comes following warning:<br>
>> Invalid argument supplied for foreach() in ... Fatal error: Call to a<br>
>> member function free() on a non-object in ...<br>
>> No object? Why? What has changed?<br>
>> Thanks<br>
>> Sven<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>
> Alan Boudreault<br>
> Mapgears<br>
> <a href="http://www.mapgears.com" target="_blank">http://www.mapgears.com</a><br>
><br>
><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> </o:p></span></font></p>
</div>
</body>
</html>