<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:m="http://schemas.microsoft.com/office/2004/12/omml" 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 14 (filtered medium)">
<style><!--
/* Font Definitions */
@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:11.0pt;
        font-family:"Calibri","sans-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;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hi Phil: Just getting back though email after being out on vacation. The queryByFilter method takes a native MapServer FILTER string and applies it against the layer. It does not process OGC filters, never has.
 The OGC filter handling code translates an OGC filter into MapServer filter string which is in turn processed by MapServer (and/or the associated driver). This is all much more straightforward in 7.0. I can try and whip up a quick example in Perl MapScript
 if that would help.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Seems like we could consider exposing an OGC filter -> MapServer filter string and then that would get handed off to queryByFilter. I think this would have to be a layer-specific method since that context is
 probably important in the translation.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Steve<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </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>Anzel, Phil - NRCS, Fort Collins, CO<br>
<b>Sent:</b> Monday, March 09, 2015 2:12 PM<br>
<b>To:</b> mapserver-users@lists.osgeo.org<br>
<b>Cc:</b> Anzel, Phil - NRCS, Fort Collins, CO<br>
<b>Subject:</b> [mapserver-users] queryByLayer - is it a valid method on layerObj?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The Mapscript SWIG interface on the layerObj defines a queryByFilter method as<o:p></o:p></p>
<p class="MsoNormal">  public int queryByFilter(mapObj map, string arg1)<o:p></o:p></p>
<p class="MsoNormal">where arg1 is supposedly the filter to apply when querying the layer, analogous to<o:p></o:p></p>
<p class="MsoNormal">    public int queryByRect(mapObj map, rectObj rect)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Where is this method documented? It is not described in either the 6.4 or 7.0 documentation. Based upon the history of the code that I’m attempting to bring back to life the method was probably documented in MapServer 4.x or 5.x. Note that
 is still visible through SWIG.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">How should it be used? I tried it with a WFS OGC filter and the log file showed (ignore line wrapping here):<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">  [Mon Mar 09 12:18:35 2015].727000 yyparse(): Expression parser error. syntax error<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">  [Mon Mar 09 12:18:35 2015].727000 msEvalExpression: Expression parser error.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">     Failed to parse expression:
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">     <Filter><Intersect><PropertyName>Geometry</PropertyName><gml:Polygon><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">       <gml:outerBoundaryIs><gml:LinearRing><gml:coordinates><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">         -88.0865046533,37.5555143852 -88.0860204771,37.5600435404
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">         -88.0782858287,37.5595392364 -88.0787704736,37.5550101113
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">         -88.0865046533,37.5555143852<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">       </gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">     </gml:Polygon></Intersect></Filter><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal">I tried with a much simpler mapfile filter and got much the same result:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">  [Mon Mar 09 12:53:22 2015].470000 yyparse(): Expression parser error. syntax error<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">  [Mon Mar 09 12:53:22 2015].470000 msEvalExpression: Expression parser error.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">    Failed to parse expression: ([mukey] in (713970, 713898))<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Do any of you have a working example of its use?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is there a way to use the OGC filter directly within mapscript code? That is ultimately what I’m after.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">- Phil Anzel <o:p></o:p></p>
<p class="MsoNormal">  USDA/NRCS contractor – Team Vistronix<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This electronic message contains information generated by the USDA solely for the intended recipients.  Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject
 the violator to civil or criminal penalties.  If you believe you have received this message in error, please notify the sender and delete the email immediately.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>