[OpenLayers-Users] refresh vector layer
Reem
r.k.alshammari at gmail.com
Tue Apr 28 05:30:52 PDT 2015
I use openlayers with geoservers layers .
currently, my problem is with refreshing vector layer that used WFS protocl
and cql_filter,
as below:
Layer2 = new OpenLayers.Layer.Vector("layer2", {
protocol:new OpenLayers.Protocol.WFS.v1_1_0({
url: GeoServerURL,
featureType: "layer2",
featureNS: "http://mapmap.org",
srsName: "EPSG:3857",
version: "1.1.0",
extractAttributes: true,
isBaseLayer: false,
visibility: true
}),
maxExtent: new OpenLayers.Bounds(-180, -90, 180,
90).transform(geographic,mercator),
displayOutsideMaxExtent: true,
displayInLayerSwitcher: false
});
Layer2.addOptions({id:'Layer2'});
Layer2.protocol.read({
filter: c_filter,
callback: processTheQuery ,
scope: [new OpenLayers.Strategy.Fixed({preload: true})]
});
when I add new feature to geoserver layer I want to refresh this layer to
get the new feature,
I triyed many ways but nothing happen with no errors!
like:
1:
map.getLayer('Layer2').protocol.setFeatureType("layer2");
map.getLayer('Layer2').refresh({featureType: "layer2",force: true});
2 :
map.getLayer('Layer2').protocol.update();
3:
map.getLayer('Layer2').refresh({ force: true, params: { 'key':
Math.random()} });
4:
map.removeLayer(Layer2);
map.addLayer(Layer2);
any help ?
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/refresh-vector-layer-tp5203286.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list