[OpenLayers-Users] Need help with Fixed Strategy for WFS layers

cgp carina_palanca at forcorp.com
Tue Jan 26 16:54:47 EST 2010


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.
-- 
View this message in context: http://n2.nabble.com/Need-help-with-Fixed-Strategy-for-WFS-layers-tp4463572p4463572.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list