[Users] WFSCapabilitiesReader - default layer strategies

Alexandre Dube adube at mapgears.com
Tue Feb 15 14:35:21 CET 2011


On 11-02-14 12:11 PM, Eric Lemoine wrote:
>> layerStrategyNames: ["BBOX", "Save"]
>>
> I absolutely have given any sort of thinking into that :-) Maybe it'd
> be better to implement this into OpenLayers.Layer.Vector, don't you
> think?

And clone that object inside the reader, I suppose ?  If so, what about 
the protocol ?  In the project I'm working on, I need to override many 
protocol options (i.e. don't take what's inside the capability).  
Wouldn't it be hard to start from wfsLayer.clone() then have to change a 
bunch of protocol and format properties after ?

Just for a preview of it, see how I'm currently using the store [1].

If we back up a little bit and see the problem from a larger 
perspective, the problem comes from the fact that if I do this :
     layerOptions: {strategies: [new OpenLayers.Strategy.BBOX()]}
then the same strategy object would be used for all layers and we don't 
want that.  Normally, in a layer definition, we would do that :

var layer = new OpenLayers.Layer.Vector("layer", {
     protocol: ...,
     strategies: [new OpenLayers.Strategy.BBOX()]
});

What if we started supporting this :
var layer = new OpenLayers.Layer.Vector("layer", {
     protocol: ...,
     strategies: ["OpenLayers.Strategy.BBOX"]
});

and this too :
var layer = new OpenLayers.Layer.Vector("layer", {
     protocol: ...,
     strategies: [{"OpenLayers.Strategy.BBOX": {ratio: 1}}]
});

That way, we would let the layer build new objects from string values 
equal to the constructor name (and with the possibility to define the 
options).  Then, we could be able to use strings as overrides values for 
the layerOptions in the WFSCapabilitiesStore.

Thoughts ?

Alexandre

P.S. I'm really sorry about this dev discuss being in the wrong place.  
At first, I always think "hey, this is a 'widget using' question" and go 
for the user list.  Please, let me know if this thread could have any 
value/interest in the OL-Dev list.


[1] WFSCapabilitiesStore

     wfsCapStore = new GeoExt.data.WFSCapabilitiesStore( {
         url: wfsCapURL,
         listeners: {
           load: {
             fn: addLayersFromWFSCapabilities,
             scope: this
           }
         },
         protocolOptions: {
             srsName: "EPSG:26917",
             url: globalOptions.WFS_URL,
             featureNS: "http://localhost"
         },
         layerOptions: {
             projection: new OpenLayers.Projection("EPSG:26917"),
             visibility: false,
             displayInLayerSwitcher: false,
             minScale: 250000
         }
     });




-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Users mailing list