Hi,<br><br>just another question about filter problems...<br>I thought that all was working but I was trying with the code below:<br><br>var edit_mine_wfs = new OpenLayers.Layer.WFS( "My wfs", "
<a href="http://localhost/cgi-bin/mapserv?map=/var/www/thesilence/webroot/mapserver/config/data_points.map&">http://localhost/cgi-bin/mapserv?map=/var/www/thesilence/webroot/mapserver/config/data_points.map&</a>", {typename: "editMinePoints", 'ilter:'<Filter><PropertyIsEqualTo><PropertyName>user_id</PropertyName><Literal>
<span style="font-weight: bold;">2</span></Literal></PropertyIsEqualTo></Filter>'}, { featureClass: OpenLayers.Feature.WFS}, { featureClass: OpenLayers.Feature.WFS});<br><br>In the "Literal" of my filter I put "2" just to test it.. but now I must pass the variable "current_user".
<br><br>I would like something like this:<br><Filter><br><PropertyIsEqualTo><br><PropertyName>user_id</PropertyName><br><Literal><span style="font-weight: bold;">current_user</span></Literal>
<br></PropertyIsEqualTo><br></Filter><br><br>but it doesnt work and I cant see anything.<br><br>Is it possible?<br>Do I have to change the keyword "Literal"?<br>Probably the problem is that I haven't the access to the value variable and the filter check the literal as a string "current_user" and not as its integer value.
<br><br>Thank you very much for every help.<br>Have a good week.<br><br><br><div><span class="gmail_quote">2007/2/16, Bart van den Eijnden (OSGIS) <<a href="mailto:bartvde@osgis.nl">bartvde@osgis.nl</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>yes after the mylayer initialization if you use mergeNewParams.<br><br>Please note, if you already know the user at initialization, you can<br>pass the parameter "filter" already in the constructor of your layer,
<br>just like you pass in typename right now.<br><br>The filter encoding I gave was just an example, for the right name of<br>the PropertyName check the DescribeFeatureType response of your<br>Mapserver WFS, something like:
<br><br><a href="http://localhost/cgi-bin/mapserv?map=/var/www/thesilence/webroot/mapserver/config/data_points.map&typename=points&service=WFS&version=1.0.0&request=DescribeFeatureType">http://localhost/cgi-bin/mapserv?map=/var/www/thesilence/webroot/mapserver/config/data_points.map&typename=points&service=WFS&version=1.0.0&request=DescribeFeatureType
</a><br><br>I would advise you to first get things running by putting a direct URL<br>in the browser, and then code the stuff in OpenLayers javascript, so try<br>something like:<br><br><a href="http://localhost/cgi-bin/mapserv?map=/var/www/thesilence/webroot/mapserver/config/data_points.map&typename=points&service=WFS&version=1.0.0&request=GetFeature&filter=">
http://localhost/cgi-bin/mapserv?map=/var/www/thesilence/webroot/mapserver/config/data_points.map&typename=points&service=WFS&version=1.0.0&request=GetFeature&filter=</a><test<br>your filter here>
<br><br>Hope this helps.<br><br>Best regards,<br>Bart<br><br>Pedrazzi Gelsomini schreef:<br>> Thank you very much for your help.<br>> I should ask you more information beacause i can't understand what i<br>> have to do.
<br>><br>> > var filter =<br>> '<Filter><PropertyIsEqualTo><PropertyName>user_id</PropertyName><Literal>3</Literal><<br>><br>> > /PropertyIsEqualTo></Filter>';
<br>><br>> > mylayer.mergeNewParams({"filter":filter});<br>><br>> Putting these instruction above i have the following error<br>><br>> "this.map has no properties"<br>> ( Grid.js
- line 171 - var viewSize = this.map.getSize();<br>><br>> Do i have to insert these instructions after mylayer initialization,<br>> that is in the function init() that creates my map?<br>> Is it correct put in the <PropertyName> the name of a field that I get
<br>> from the SELECT query of the OVF file?<br>><br>> Is it enough to add this code lines or I have to do something other in<br>> order to make working the Filter Encoding?<br>> Sorry for the trivial questions but i am quite new in this subject.
<br>><br>> Thanks a lot for your time!<br>><br>><br>><br>> 2007/2/16, Bart van den Eijnden (OSGIS) <<a href="mailto:bartvde@osgis.nl">bartvde@osgis.nl</a><br>> <mailto:<a href="mailto:bartvde@osgis.nl">
bartvde@osgis.nl</a>>>:<br>><br>> Hi,<br>><br>> you need to use the FILTER parameter from the OGC WFS spec to do<br>> this, check<br>> this for more info:<br>><br>> <a href="http://mapserver.gis.umn.edu/docs/howto/filterencoding/">
http://mapserver.gis.umn.edu/docs/howto/filterencoding/</a><br>> <<a href="http://mapserver.gis.umn.edu/docs/howto/filterencoding/">http://mapserver.gis.umn.edu/docs/howto/filterencoding/</a>><br>><br>> then you need to call mergeNewParams on your OpenLayers layer:
<br>><br>> var filter =<br>> '<Filter><PropertyIsEqualTo><PropertyName>USER</PropertyName><br>> <Literal>Peter</Literal></PropertyIsEqualTo></Filter>';
<br>><br>> mylayer.mergeNewParams({"filter":filter});<br>><br>> Best regards,<br>> Bart<br>><br>> --<br>> Bart van den Eijnden<br>> OSGIS, Open Source GIS<br>>
<a href="http://www.osgis.nl">http://www.osgis.nl</a><br>><br>><br>> --------- Oorspronkelijk bericht --------<br>> Van: Pedrazzi Gelsomini <<a href="mailto:pedrazzi.gelsomini@gmail.com">pedrazzi.gelsomini@gmail.com
</a><br>> <mailto:<a href="mailto:pedrazzi.gelsomini@gmail.com">pedrazzi.gelsomini@gmail.com</a>>><br>> Naar: <a href="mailto:users@openlayers.org">users@openlayers.org</a> <mailto:<a href="mailto:users@openlayers.org">
users@openlayers.org</a>> <<br>> <a href="mailto:users@openlayers.org">users@openlayers.org</a> <mailto:<a href="mailto:users@openlayers.org">users@openlayers.org</a>>><br>> Onderwerp: [OpenLayers-Users] Changing map file FILTER parameter
<br>> via URL -<br>> WFS layer with OVF connection<br>> Datum: 16/02/07 13:02<br>><br>> > Hi everyone,I m using openlayers for my application and I have a<br>> WFS layer<br>> filled by my mysql database using
mapserver.My layer<br>> inizialitazion is:<br>> > var user_wfs = new OpenLayers.Layer.WFS( &quot;User Points&quot;,<br>> ><br>> ><br>> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>><br>> &nbsp;&nbsp;&nbsp;<br>> &quot;http://localhost/cgi-bin/mapserv?map=/var/www/thesilence/webroot/mapserver/config/data_points.map&amp;<br>> > &quot;,<br>> >
<br>> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {typename:<br>> &quot;points&quot;}, { featureClass: OpenLayers.Feature.WFS});<br>> >
<br>> > In my file.map i have the following layer:LAYER&nbsp;&nbsp;&nbsp;<br>> CONNECTION &quot;my_points.ovf&quot;&nbsp;&nbsp;&nbsp; CONNECTIONTYPE<br>> OGR&nbsp;&nbsp;&nbsp; DATA &quot;points&quot;&nbsp;&nbsp;&nbsp;
<br>> METADATA<br>> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br>> &quot;wms_srs&quot;&nbsp;&nbsp;&nbsp;<br>> &quot;EPSG:4326&quot;<br>> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<br>> &quot;wms_title&quot;&nbsp;&nbsp;&nbsp;<br>> &quot;points&quot;&nbsp;&nbsp;&nbsp;<br>> &nbsp;&nbsp;&nbsp; &quot;wfs_srs&quot;&nbsp;&nbsp;&nbsp;
<br>> &quot;EPSG:4326&quot;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br>> &quot;wfs_title&quot;&nbsp;&nbsp;&nbsp;<br>> &quot;points&quot;&nbsp;&nbsp;&nbsp;
<br>> &nbsp;&nbsp;&nbsp; &quot;gml_featureid&quot;&nbsp;&nbsp;&nbsp;<br>> &quot;fid&quot;<br>> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<br>> &quot;gml_include_items&quot;&nbsp;<br>> &quot;all&quot;&nbsp;&nbsp;&nbsp; END&nbsp;&nbsp;&nbsp; NAME<br>> &quot;points&quot;&nbsp;&nbsp;&nbsp; SIZEUNITS
<br>> PIXELS&nbsp;&nbsp;&nbsp;<br>> STATUS ON&nbsp;&nbsp;&nbsp; DUMP TRUE&nbsp;&nbsp;&nbsp;<br>> PROJECTION&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<br>> &quot;init=epsg:4326&quot;&nbsp;&nbsp;&nbsp; END<br>> > &nbsp;&nbsp;&nbsp; TOLERANCE 20&nbsp;&nbsp;&nbsp; TOLERANCEUNITS<br>> PIXELS&nbsp;&nbsp;&nbsp; TYPE POINT&nbsp;&nbsp;&nbsp; UNITS
<br>> METERS&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FILTERITEM<br>> &quot;user_id&quot;&nbsp;&nbsp;&nbsp; #FILTER &quot;&quot;where<br>> my_points.ovf is:&lt;OGRVRTDataSource&gt;
<br>> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;OGRVRTLayer<br>> name=&quot;points&quot;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>> &lt;SrcDataSource&gt;ODBC:myuser/mypsw@mydns&lt;/SrcDataSource&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>> &lt;SrcSQL&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SELECT
<br>> data_points.id AS<br>> fid, latitude, longitude, des_walks.com_user_id AS user_id<br>> > &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FROM data_points JOIN<br>> des_walks&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; WHERE des_walks.id =
<br>> data_points.des_walk_id&nbsp;&nbsp;&nbsp;<br>> &lt;/SrcSQL&gt;&nbsp;&nbsp;&nbsp;<br>> &lt;GeometryType&gt;wkbPoint&lt;/GeometryType&gt;&nbsp;&nbsp;&nbsp;
<br>> &lt;LayerSRS&gt;WGS84&lt;/LayerSRS&gt;<br>> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;GeometryField<br>> encoding=&quot;PointFromColumns&quot; x=&quot;longitude&quot;
<br>> y=&quot;latitude&quot;/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>> &lt;/OGRVRTLayer&gt;&lt;/OGRVRTDataSource&gt;but I need to change<br>> the value
<br>> of the FILTER parameter in the map file via URL.<br>> ><br>> > The connection with database works and allows me to put my<br>> points on my<br>> map.I would like to filter these data by &quot;user_id&quot; and
<br>> show only<br>> the data linked to a specific user, but i have to pass this<br>> parameter via<br>> url because it is not always the same.<br>> ><br>> > Now i m passing just the typename in the openlayers function,
<br>> but i dont<br>> know how to change the FILTER parameter in my map<br>> file.&nbsp;&nbsp;&nbsp;<br>> FILTERITEM &quot;user_id&quot;<br>> > &nbsp;&nbsp;&nbsp; #FILTER &quot;&quot;Any suggestion?Thank you
<br>> very much!<br>> ><br>> ><br>> ><br>> ><br>> ><br>> > _______________________________________________<br>> > Users mailing list<br>> >
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a> <mailto:<a href="mailto:Users@openlayers.org">Users@openlayers.org</a>><br>> > <a href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users
</a><br>> ><br>><br>><br>><br>><br>><br>><br>> --<br>> Ilaria Gelsomini<br>> Francesca Pedrazzi<br><br><br>--<br>Bart van den Eijnden<br>OSGIS, Open Source GIS<br><a href="mailto:bartvde@osgis.nl">
bartvde@osgis.nl</a><br><a href="http://www.osgis.nl">http://www.osgis.nl</a><br><br></blockquote></div><br><br clear="all"><br>-- <br>Ilaria Gelsomini<br>Francesca Pedrazzi