<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:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="&#1;" 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 12 (filtered medium)">
<base href="x-msg://52/">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.apple-tab-span
        {mso-style-name:apple-tab-span;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:887912329;
        mso-list-type:hybrid;
        mso-list-template-ids:248933474 1951977966 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:22.5pt;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple style='word-wrap: break-word;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>The way loadQuery works is like so:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoListParagraph style='margin-left:22.5pt;text-indent:-.25in;
mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>1)<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Load the
queryfile into an internal queryObj<o:p></o:p></span></p>

<p class=MsoListParagraph style='margin-left:22.5pt;text-indent:-.25in;
mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>2)<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Execute
the query defined by the queryObj<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>If an error occurs at step 1 you&#8217;ll get a load error of
some sort. &nbsp;If at 2 it is deeper inside one of the query methods. I&#8217;m
not a PHP user but in Perl you can access the msGetErrorString() function like
so:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; print mapscript::msGetErrorString(&#8220;\n&#8221;);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>This will print the entire error stack one per line.
PHP-MapScript must have something similar. We need to know if the problem is
parsing the query file or if it&#8217;s running the query itself.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Steve<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
mapserver-users-bounces@lists.osgeo.org
[mailto:mapserver-users-bounces@lists.osgeo.org] <b>On Behalf Of </b>Moen, Paul
T.<br>
<b>Sent:</b> Monday, February 08, 2010 12:51 PM<br>
<b>To:</b> mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> Re: [mapserver-users] php mapscript loadQuery problem<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><span class=apple-style-span><span style='font-size:11.5pt;
font-family:"Calibri","sans-serif";color:#1F497D'>The query file parser will
throw a detailed error message if it has a parsing problem.</span></span><o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif";
color:black'><br>
<span class=apple-style-span>Where would I look for the errors that the query
file parser throws? &nbsp;I don't see any in the error_log for apache, which is
where all my php errors are logged. &nbsp;Does that mean that the parser is
having no problems parsing the file, but something else goes awry?</span></span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal><span class=apple-style-span><span style='font-size:13.5pt;
font-family:"Helvetica","sans-serif";color:black'>I added some information
hoping it may help.</span></span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>This is my command from php<o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal><span class=apple-tab-span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$test
= $map-&gt;saveQuery(&quot;/tmp/testfile.txt&quot;);<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span class=apple-tab-span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>error_log($test.&quot;
&quot;.MS_SUCCESS);<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span class=apple-tab-span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>The
output from the error_log line above is Testing save query: 0 0<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>I then try to load the query file with the following
commands.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span class=apple-tab-span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$test
= $map-&gt;loadQuery(&quot;/tmp/testfile.txt&quot;);<o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal><span class=apple-tab-span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>error_log(&quot;Testing
load = &quot;.$test.&quot; - &quot;.MS_SUCCESS);<o:p></o:p></p>

</div>

</div>

<div>

<p class=MsoNormal><span class=apple-tab-span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>The
output from the error_log line above is&nbsp;Testing load = 1 - 0<o:p></o:p></p>

</div>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<p class=MsoNormal>Thanks,<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>Paul<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<div>

<p class=MsoNormal>On Feb 1, 2010, at 3:55 PM, Lime, Steve D (DNR) wrote:<o:p></o:p></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I&#8217;ll send you more details when I get time tonite (I hope)
and can test things. I&#8217;ve been using 5.6 save/load query functions a ton
via the CGI but not PHP. I tested a bunch with Perl MapScript and will have to
check those methods against what PHP is doing. Here&#8217;s what the lines mean:</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Line &#8211; Contents</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>0 - magic string</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>1 - mode, type (single or multiple), qlayer, slayer</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>2 - point x, point y, buffer, max results (queryByPoint)</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>3 - query rect (minx, miny, maxx, maxy) (queryByRect)</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>4 - shp index, tile index, clear cache flag (queryByIndex)</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>5 - qitem or NULL (queryByAttribute)</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>6 - qstring or NULL</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>7 - operator (used by WFS)</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>8+ - query shape (queryByShape)</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Basically each line or so after the first couple match a
MapServer query method and it&#8217;s parameters. The file contents look fine
to me. The query file parser will throw a detailed error message if it has a
parsing problem.</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Steve</span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

</div>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in;
border-width:initial;border-color:initial'>

<div>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
class=apple-converted-space><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>&nbsp;</span></span><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'><a
href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a><span
class=apple-converted-space>&nbsp;</span>[mailto:mapserver-users-bounces@lists.osgeo.org]<span
class=apple-converted-space>&nbsp;</span><b>On Behalf Of<span
class=apple-converted-space>&nbsp;</span></b>Moen, Paul T.<br>
<b>Sent:</b><span class=apple-converted-space>&nbsp;</span>Monday, February 01,
2010 2:42 PM<br>
<b>To:</b><span class=apple-converted-space>&nbsp;</span><a
href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
<b>Subject:</b><span class=apple-converted-space>&nbsp;</span>[mapserver-users]
php mapscript loadQuery problem</span><o:p></o:p></p>

</div>

</div>

</div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal>I have not been able to get loadQuery to work. &nbsp;The
saveQuery command creates the file and returns MS_SUCCESS. &nbsp;When I try to
load the file using loadQuery, it always returns MS_FAILURE. &nbsp;I get no
other errors. &nbsp;&nbsp;The permissions are good. &nbsp;Is there a way to
enable more verbose error logging to find out what is going on? &nbsp;Is there
any documentation on what should be in the saved file?<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>The following is the text from one of the saved query files.<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

</div>

<div>

<div>

<div>

<p class=MsoNormal>MapServer Query - Generated by msSaveQuery()<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>1 2 83 -1<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>-1 -1 0 0<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>2183769.22727273 944435.909090909 2331977.40909091
1066349.09090909<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>-1 -1 1<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>NULL<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>NULL<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>-1<o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal>0<o:p></o:p></p>

</div>

</div>

</div>

<div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

</div>

<div>

<p class=MsoNormal>This is my version.<o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal>&nbsp;<o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal><span class=apple-style-span><span style='font-size:9.0pt;
font-family:"Arial","sans-serif"'>MapServer version 5.6.1 OUTPUT=GIF OUTPUT=PNG
OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG
SUPPORTS=CAIRO SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER
SUPPORTS=SOS_SERVER SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR
INPUT=GDAL INPUT=SHAPEFILE</span></span><o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><br>
<br>
<br>
</span><o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span class=apple-style-span><span style='font-family:"Arial","sans-serif"'>Thanks,</span></span><o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span style='font-family:"Arial","sans-serif"'><br>
<br>
<br>
</span><o:p></o:p></p>

</div>

</div>

<div>

<div>

<p class=MsoNormal><span class=apple-style-span><span style='font-family:"Arial","sans-serif"'>Paul</span></span><o:p></o:p></p>

</div>

</div>

</div>

</div>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</div>

</body>

</html>