[OpenLayers-Users] Need help with Fixed Strategy for WFS layers
Alexandre Dube
adube at mapgears.com
Wed Jan 27 08:40:07 EST 2010
Hi,
With firebug, grab the url of the getFeature request and so the whole
thing manually, something like that (untested and I'm not sure about the
.v2 part) :
var oFeatures;
OpenLayers.loadURL(szURL, '', this, parseResponse);
parseResponse = function(response) {
var oFormat = OpenLayers.Format.GML.v2();
oFeatures = oFormat.read(response);
}
// do what you want with your features that are unbounded to any layer.
Hope this helps,
Alexandre
cgp wrote:
> My goal is to have WFS features loaded onto the map before I call a function
> that accesses these features. The catch is I need to keep the WFS features
> hidden, cause I don't really need to see them. I have my code like this:
>
> var wfs_layer = new OpenLayers.Layer.Vector("wfs layer", {
> strategies: [new OpenLayers.Strategy.BBOX(),new
> OpenLayers.Strategy.Fixed()],
> protocol: new OpenLayers.Protocol.WFS({
> version: "1.1.0",
> url: "/geoserver/wfs",
> featureType: wfs_feat_type,
> featureNS: "http://geoserver.sf.net",
> featurePrefix: "sde",
> srsName: "EPSG:900913",
> geometryName: "SHAPE"
> })
> });
> wfs_layer.setVisibility(false);
> map.addLayers([wfs_layer]);
>
> Since the layer is not visible, it doesn't load the features. So I call the
> following:
>
> map.getLayersByName(l_name+" wfs")[0].strategies[1].load();
>
> The problem with this is that it behaves inconsistently. Sometimes it won't
> load any features, sometimes it will only load a few features, and at times
> it will load all the features. I don't understand why it does that. Does
> anyone know why?
>
> I tried to do this too: new OpenLayers.Strategy.Fixed({preload:true}), but
> some of my layers are too large and it crashes my browser. So that's out of
> the question. Any ideas? Thanks.
>
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Users
mailing list