This is how I have it working:
wfs = new OpenLayers.Layer.Vector("States", {
               strategies: [new OpenLayers.Strategy.BBOX()],
               protocol: new OpenLayers.Protocol.WFS({
                   url: "http://localhost:8080/geoserver/wfs";,
                   featureType: "traget_grave3",
                   featureNS: "http://www.openplans.org/TestSpace";,
                   srsName: "EPSG:900913",
                   version: "1.1.0",
                   extractAttributes: true,
                   isBaseLayer: false,
                   visibility: true
               }),
        filter: new OpenLayers.Filter.Logical({
                        type: OpenLayers.Filter.Logical.OR,
                        filters: 
                [
                new OpenLayers.Filter.Comparison({
                                        type:
OpenLayers.Filter.Comparison.EQUAL_TO,
                                        property: " GRAV_ID ",
                                        value: "3 A 1"
                        }),
                new OpenLayers.Filter.Comparison({
                                type: OpenLayers.Filter.Comparison.EQUAL_TO,
                                property: " GRAV_ID ",
                                value: "3 B 2"
                         })
                ]
            })
});
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Mustafa646
Sent: Tuesday, March 08, 2011 10:13 AM
To: [email protected]
Subject: [OpenLayers-Users] Why Filter do not work ?

hi,

By using code below, i successfully Draw  frature layer over Google Map

 var gmap = new OpenLayers.Layer.Google(
           "Google Streets", // the default
           {'sphericalMercator':true, numZoomLevels: 20 });

 wfs = new OpenLayers.Layer.Vector("States", {
               strategies: [new OpenLayers.Strategy.BBOX()],
               protocol: new OpenLayers.Protocol.WFS({
                   url: "http://localhost:8080/geoserver/wfs";,
                   featureType: "traget_grave3",
                   featureNS: "http://www.openplans.org/TestSpace";,
                   srsName: "EPSG:900913",
                   version: "1.1.0",
                   extractAttributes: true,
                   isBaseLayer: false,
                   visibility: true
               }),
map.addLayers([gmap,wfs]);

But when I use Filter to draw specific features on Google Map (code below),
then nothing happened and no features draw on Google Map.
Please explain where is problem and how i can fix it. I have already done
great search, but unfortunatelly could not found any solution.
please help!

 var myfilter = new OpenLayers.Filter.Comparison({
               type: OpenLayers.Filter.Comparison.EQUAL_TO,
               property: "GRAV_ID",
               value: "3 A 1"
           });

 wfs = new OpenLayers.Layer.Vector("States", {
               strategies: [new OpenLayers.Strategy.BBOX()],
               protocol: new OpenLayers.Protocol.WFS({
                   url: "http://localhost:8080/geoserver/wfs";,
                   featureType: "traget_grave3",
                   featureNS: "http://www.openplans.org/TestSpace";,
                   srsName: "EPSG:900913",
                   version: "1.1.0",
                   extractAttributes: true,
                   isBaseLayer: false,
                   visibility: true
               }),
               filter: myfilter
});
map.addLayers([gmap,wfs]);

--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Why-Filter-do-not-work-tp6126939p6126
939.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to