I made it!<br><br>I&#39;ve just change the line<br>if (@$oLayer-&gt;queryByShape($oSpatialFilter) == MS_SUCCESS) {<br>for<br>if (@$oLayer-&gt;queryByAttributes($field, $filter, MS_MULTIPLE) == MS_SUCCESS) {<br><br>where:<br>
- $field is the item (attribute) on wich the query is performed;<br>- $filter is the expression<br>- MS_MULTIPLE allow to selection of all records returned (use MS_SINGLE to select only the first record)<br>Ex.: queryByAttributes(&#39;gid&#39;, &#39;gid in (1, 2, 3)&#39;, MS_MULTIPLE)<br>
<br>I am a little bit confused about the $field parameter, because I can set it to be any field of the layer, it don&#39;t affects the query. But I have to set a valid field of the layer...<br>in the $filter parameter I can use any &quot;where&quot; expression supported by PostGIS (st_intersects, st_area, in, and, like ...)<br>
I am using a mapfile pointing to tables in PostGIS.. <br><br><br>-----<br><br>PS.: I don&#39;t known how to call queryByShape and queryByAttributes at the same time and combine the results!<br><br>Reference of the queryByAttributes method:<br>
<a href="http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/layerobj">http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/layerobj</a><br><br><br>Best Regards<br>Vitor Fortunato<br><br>
<br><br><br><div class="gmail_quote">On Sat, May 31, 2008 at 9:30 PM, Paul Spencer &lt;<a href="mailto:pspencer@dmsolutions.ca">pspencer@dmsolutions.ca</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Vitor,<br>
<br>
you are not doing anything wrong, the mapserver code for the query() function just hasn&#39;t been updated to use the filter value in Query.php (although it does parse it from the request parameters).<br>
<br>
Patches welcome :)<br>
<br>
Cheers<br>
<br>
Paul<div><div></div><div class="Wj3C7c"><br>
<br>
On 29-May-08, at 6:03 AM, Vitor Fortunato wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
I am having problems to use the map.query() method to filter attributes.<br>
In this method you can send a SQL filter inside the options parameter.<br>
But it didn&#39;t works for me...<br>
<br>
I think the query method is ignoring this parameter.<br>
<br>
I&#39;ve found the code bellow in the query.php file, and it seems that this file is not using the filter parameter...<br>
The code bellow, shows only the queryByShape using the $oSpatialFilter parameter...<br>
<br>
<br>
/// ... ... ... &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
<br>
if (@$oLayer-&gt;queryByShape($oSpatialFilter) == MS_SUCCESS) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$result-&gt;hasSelection = true;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$layerName = $oLayer-&gt;name;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;array_push($result-&gt;layers, $layerName);<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$result-&gt;$layerName-&gt;featureCount = $oLayer-&gt;getNumResults();<br>
 &nbsp; &nbsp; &nbsp; &nbsp;//TODO: dump out the extents of the selection<br>
 &nbsp; &nbsp;}<br>
<br>
/// &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; ... ... ...<br>
<br>
<br>
<br>
<br>
I have a simple widget that uses the following code:<br>
<br>
execute : function() {<br>
 &nbsp; &nbsp;var options = {};<br>
 &nbsp; &nbsp;options.selectionType = &#39;INTERSECTS&#39;;<br>
 &nbsp; &nbsp;options.geometry = &quot;POLYGON((-75.58840579710144 -10.755072463768112, -61.16086956521739 -10.755072463768112, -61.16086956521739 0.005797101449276809, -75.58840579710144 0.005797101449276809, -75.58840579710144 -10.755072463768112))&quot;;<br>

 &nbsp; &nbsp;options.maxFeatures = 0;<br>
 &nbsp; &nbsp;options.filter = &quot;gid=1&quot;<br>
 &nbsp; &nbsp;options.layers = &#39;States&#39;;<br>
<br>
 &nbsp; &nbsp;this.getMap().query(options);<br>
}<br>
<br>
<br>
the polygon intersects with 5 states, but I would like to select just the state with &#39;gid = 1&#39;, using the filter option.<br>
My code select the 5 states that intersect with the polygon and don&#39;t apply the filter.<br>
<br>
What I am doing wrong?<br>
<br></div></div>
_______________________________________________<br>
fusion-users mailing list<br>
<a href="mailto:fusion-users@lists.osgeo.org" target="_blank">fusion-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/fusion-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/fusion-users</a><br>
</blockquote>
<br>
<br>
__________________________________________<br><font color="#888888">
<br>
 &nbsp; Paul Spencer<br>
 &nbsp; Chief Technology Officer<br>
 &nbsp; DM Solutions Group Inc<br>
 &nbsp; <a href="http://www.dmsolutions.ca/" target="_blank">http://www.dmsolutions.ca/</a><br>
<br>
</font></blockquote></div><br>