[OpenLayers-Users] Trouble with accessing vector/WFS layer features

Ivan Grcic igrcic at gmail.com
Mon Dec 21 12:35:16 EST 2009


Well,

layer.refresh({force:true}) wont do because this method is checking
layer visibility

    refresh: function(obj) {
        if(this.calculateInRange() && this.visibility) {
            this.events.triggerEvent("refresh", obj);
        }
    },


but I think calling trigger read on BBOX strategy should do:

layer.strategies[0].triggerRead()

Cheers


On Mon, Dec 21, 2009 at 4:44 PM, cgp <carina_palanca at forcorp.com> wrote:
>
> I am adding the layer like this:
>
>                var wfs_layer3 = new OpenLayers.Layer.Vector("WFS Layer 3", {
>                        strategies: [ new OpenLayers.Strategy.BBOX(), saveStrategy],
>                        protocol: new OpenLayers.Protocol.WFS({
>                                url:  "/geoserver/wfs",
>                                featureType: "user_layer.layer_name",
>                                featureNS: "http://geoserver.sf.net",
>                                featurePrefix: "sde",
>                                srsName: "EPSG:900913",
>                                version: "1.1.0",
>                                geometryName:"SHAPE"
>                        })
>                });
>                 map.addLayers([wfs_layer3]);
>
>
> Ivan Grcic-2 wrote:
>>
>> Hi,
>>
>> vector layer doesnt load features if it is not visible. What
>> strategy&protocol are you using?
>>
>> On Fri, Dec 18, 2009 at 11:29 PM, cgp <carina_palanca at forcorp.com> wrote:
>>>
>>> When I start up my application, I add all the WFS layers and do
>>> setVisibility(false). Right after start up I attempt to access the WFS
>>> layer
>>> features with wfs_layer.features but it returns null. However, when I run
>>> setVisibility(true) and then setVisibility(false) right away,
>>> wfs_layer.features now returns all the features.
>>>
>>> I don't completely understand how OpenLayers works, but does this mean
>>> that
>>> the WFS layers are not actually loaded onto the map if onstartup I call
>>> setVisibility(false)?
>>>
>>> My goal is to access the features without having to display the WFS
>>> layer.
>>> On my previous post
>>> http://n2.nabble.com/Is-there-a-way-to-dynamically-get-the-feature-id-of-a-feature-from-a-WMS-layer-td4183834.html#a4183834
>>> here , I am doing this because I need to get the ID of a particular
>>> feature.
>>> (Unless someone else has a more efficient way of doing this, please let
>>> me
>>> know).
>>>
>>> Thanks for your help.
>>> --
>>> View this message in context:
>>> http://n2.nabble.com/Trouble-with-accessing-vector-WFS-layer-features-tp4189252p4189252.html
>>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>>
>>
>>
>>
>> --
>> Ivan Grcic
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/Trouble-with-accessing-vector-WFS-layer-features-tp4189252p4199050.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



-- 
Ivan Grcic



More information about the Users mailing list