[OpenLayers-Users] Why Filter do not work ?

Mustafa646 noorcs22 at gmail.com
Tue Mar 8 10:12:55 EST 2011


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-tp6126939p6126939.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list