[OpenLayers-Users] Changing map file FILTER parameter via URL -
WFS layer with OVF connection
Pedrazzi Gelsomini
pedrazzi.gelsomini at gmail.com
Fri Feb 16 13:51:17 EST 2007
Fixed!
I put the filter condition directly in the initialization of the layer and i
have not the problem with map properties!
And it works!!
Here the code:
var user_wfs = new OpenLayers.Layer.WFS
( "User Points",
"
http://localhost/cgi-bin/mapserv?map=/var/www/thesilence/webroot/mapserver/config/data_points.map&",
{typename: "points", Filter:
'<Filter><PropertyIsEqualTo><PropertyName>user_id</PropertyName><Literal>2</Literal></PropertyIsEqualTo></Filter>'},
{ featureClass: OpenLayers.Feature.WFS}
);
Now the filtering of my data is working... thank you very much for your
help!
Cheers
2007/2/16, Pedrazzi Gelsomini <pedrazzi.gelsomini at gmail.com>:
>
> Thank you very much for your help.
> I should ask you more information beacause i can't understand what i have
> to do.
>
> > var filter =
> '<Filter><PropertyIsEqualTo><PropertyName>user_id</PropertyName><Literal>3</Literal><
>
> > /PropertyIsEqualTo></Filter>';
>
> > mylayer.mergeNewParams({"filter":filter});
>
> Putting these instruction above i have the following error
>
> "this.map has no properties"
> ( Grid.js - line 171 - var viewSize = this.map.getSize();
>
> Do i have to insert these instructions after mylayer initialization, that
> is in the function init() that creates my map?
> Is it correct put in the <PropertyName> the name of a field that I get
> from the SELECT query of the OVF file?
>
> Is it enough to add this code lines or I have to do something other in
> order to make working the Filter Encoding?
> Sorry for the trivial questions but i am quite new in this subject.
>
> Thanks a lot for your time!
>
>
>
> 2007/2/16, Bart van den Eijnden (OSGIS) <bartvde at osgis.nl>:
> >
> > Hi,
> >
> > you need to use the FILTER parameter from the OGC WFS spec to do this,
> > check
> > this for more info:
> >
> > http://mapserver.gis.umn.edu/docs/howto/filterencoding/
> >
> > then you need to call mergeNewParams on your OpenLayers layer:
> >
> > var filter =
> > '<Filter><PropertyIsEqualTo><PropertyName>USER</PropertyName>
> > <Literal>Peter</Literal></PropertyIsEqualTo></Filter>';
> >
> > mylayer.mergeNewParams({"filter":filter});
> >
> > Best regards,
> > Bart
> >
> > --
> > Bart van den Eijnden
> > OSGIS, Open Source GIS
> > http://www.osgis.nl
> >
> >
> > --------- Oorspronkelijk bericht --------
> > Van: Pedrazzi Gelsomini <pedrazzi.gelsomini at gmail.com>
> > Naar: users at openlayers.org < users at openlayers.org>
> > Onderwerp: [OpenLayers-Users] Changing map file FILTER parameter via URL
> > -
> > WFS layer with OVF connection
> > Datum: 16/02/07 13:02
> >
> > > Hi everyone,I m using openlayers for my application and I have a WFS
> > layer
> > filled by my mysql database using mapserver.My layer inizialitazion is:
> > > var user_wfs = new OpenLayers.Layer.WFS( "User Points",
> > >
> > >
> >
> >
> >
> >
> > "http://localhost/cgi-bin/mapserv?map=/var/www/thesilence/webroot/mapserver/config/data_points.map&
> > > ",
> > >
> > > {typename:
> > "points"}, { featureClass: OpenLayers.Feature.WFS});
> > >
> > > In my file.map i have the following layer:LAYER
> > CONNECTION "my_points.ovf" CONNECTIONTYPE
> > OGR DATA "points" METADATA
> >
> > "wms_srs"
> > "EPSG:4326"
> > >
> > "wms_title"
> > "points"
> > "wfs_srs"
> > "EPSG:4326"
> > "wfs_title"
> > "points"
> > "gml_featureid"
> > "fid"
> > >
> > "gml_include_items"
> > "all" END NAME
> > "points" SIZEUNITS PIXELS
> > STATUS ON DUMP TRUE
> > PROJECTION
> > "init=epsg:4326" END
> > > TOLERANCE 20 TOLERANCEUNITS
> > PIXELS TYPE POINT UNITS
> > METERS FILTERITEM
> > "user_id" #FILTER ""where
> > my_points.ovf is:<OGRVRTDataSource>
> > > <OGRVRTLayer
> > name="points">
> > <SrcDataSource>ODBC:myuser/mypsw at mydns
> > </SrcDataSource>
> > <SrcSQL> SELECT
> > data_points.id AS
> > fid, latitude, longitude, des_walks.com_user_id AS user_id
> > > FROM data_points JOIN
> > des_walks WHERE des_walks.id =
> > data_points.des_walk_id
> > </SrcSQL>
> > <GeometryType>wkbPoint</GeometryType>
> > <LayerSRS>WGS84</LayerSRS>
> > > <GeometryField
> > encoding="PointFromColumns" x="longitude"
> > y="latitude"/>
> > </OGRVRTLayer></OGRVRTDataSource>but I need to change the
> > value
> > of the FILTER parameter in the map file via URL.
> > >
> > > The connection with database works and allows me to put my points on
> > my
> > map.I would like to filter these data by "user_id" and show
> > only
> > the data linked to a specific user, but i have to pass this parameter
> > via
> > url because it is not always the same.
> > >
> > > Now i m passing just the typename in the openlayers function, but i
> > dont
> > know how to change the FILTER parameter in my map
> > file.
> > FILTERITEM "user_id"
> > > #FILTER ""Any suggestion?Thank you very
> > much!
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Users mailing list
> > > Users at openlayers.org
> > > http://openlayers.org/mailman/listinfo/users
> > >
> >
> >
> >
> >
>
>
> --
> Ilaria Gelsomini
> Francesca Pedrazzi
--
Ilaria Gelsomini
Francesca Pedrazzi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070216/b6f3c0a1/attachment.html
More information about the Users
mailing list