[OpenLayers-Users] how to extractAttributes in WFS GetFeature Example?

Alex Zeit zeitalex at googlemail.com
Thu Apr 8 11:41:00 EDT 2010


Solved.
I downloaded WFS GetFeature Example again and everything works fine now.
One cann access attributes as follows:
            control.events.register("featureselected", this, function(e) {
                select.addFeatures([e.feature]);
                document.getElementById('featurename').innerHTML = "Selected
"  +e.feature.attributes.STATE_NAME;
            });


2010/4/8 Alex Zeit <zeitalex at googlemail.com>

> just figured out: firebug shows that extractAttributes is already true.
> But why there is no attributes? Do I need to add them extra or they added
> with:
>
> control.events.register("featureselected", this, function(e) {
>     select.addFeatures([e.feature]);
> }
>
> 2010/4/8 Alex Zeit <zeitalex at googlemail.com>
>
> Dear All,
>> 1) How can I set extractAttributes to true in WFS GetFeature Example to
>> get access to feature attributes?
>> I tried with OpenLayers.Protocol.WFS but without success.
>> 2) Is it a right way to access attributes?:
>>         control.events.register("featureselected", this, function(e) {
>>                 select.addFeatures([e.feature]);
>>             var feats = e.layer.features; // This is the Layer.Vector
>>             for(item in feats) {
>>                 atts = item.attributes;
>>                 alert(atts.first);
>>             }
>>     OR
>>             for(i = 0; i < feats.length; i++) {
>>                 alert(feats[i].attributes.first);
>>             }
>>             });
>>
>> WFS GetFeature Example I am customizing is on:
>>
>> http://hboard.iwk.uni-karlsruhe.de:8080/QuickStartWicket-1.0-SNAPSHOT/qswicket/?wicket:bookmarkablePage=:wicketqs.GetFeatureWfs
>>
>> Any help would be highly appreciated
>> Alex
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100408/be7e2db4/attachment.html


More information about the Users mailing list