[OpenLayers-Users] WFS-Filter refresh layer Problem
Marc Jansen
jansen at terrestris.de
Sat Oct 10 08:01:13 EDT 2009
Hi Simon,
find comments inline in your email.
fLaNsch at gmx.de schrieb:
> Hi Users/List,
> i've created (Openlayer2.8) a filter-definition and a wfs-layer like :
>
> //FILTER:
> var wfsfilter = '<ogc:Filter xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">'+'<ogc:OR><ogc:PropertyIsEqualTo><ogc:PropertyName>type</ogc:PropertyName><ogc:Literal>'+one+'</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>type</ogc:PropertyName><ogc:Literal>'+two+'</ogc:Literal></ogc:PropertyIsEqualTo></ogc:OR></ogc:Filter>';
>
> //WFS:
> wfs = new OpenLayers.Layer.WFS(
> "WFS-Tooltip",
> "http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/wfs/wfs.map",
> {typename: 'test', filter: wfsfilter},
> {styleMap: styleMap, extractAttributes:true}
> );
>
> and it works fine..
> But now i wanted to change the Filter settings, when a different WMS-Layer change his visibilty. So i created a trigger function like:
>
> //Trigger:
> wms-layer.events.on({ "visibilitychanged": Toggle });
>
the variable name of your layer is hopefully not "wms-layer", or is it?
AFAIK the dash isn't allowed in variable names of JavaScript.
> function Toggle(event) {...set different Filter here...}
>
Have you tried calling the function manually? Is it working then?
> My problem now is to update/refresh/reload the WFS-Layer with new Filtersettings, so that the correct Features get highlighted and Tooltip is shown. I tried:
> wfs.refresh({force: true});
> wfs.mergeNewParams({'bla': Math.random()});
>
mergeNewParams() should do the trick, and worked for me in the past
> But nothing helps. Any ideas?
>
What is the exact error you get? Is the function not being called?, is
the new GET-param not being set?, is the answer from the WFS-Server not
right?, are the features not being updated?
> Thanks for any help!!
> Best regards,
> Simon
>
Regards,
Marc
More information about the Users
mailing list