[OpenLayers-Users] Help on Feature Attributes

Elavazhagan.M elavazhagan.mouniandy at kcubeconsulting.com
Wed Sep 26 11:41:32 EDT 2007


Dear List,

 

I am a newbie in using OpenLayers. 

I have setup my WFS server layers with ["gml_include_items" "all"] which
successfully serve PostGIS layers. I am able to add a WFS layer as my base
layer and I'm able to view, zoom pan the map. But I don't know how to get
the attribute information associated with the features. .I tried with
"OpenLayers. Feature. Vector" class's attributes property but it's not
working for me. I tried the following codes but nothing seemed to work:

 

#1.

var feature = wfsLayer.getFeatureFromEvent(e); //this is getting me a
feature on double click without any troble

if(feature) {

    alert(feature.attributes[0]);

}

 

#2.

var feature = wfsLayer.getFeatureFromEvent(e);

if(feature) {

      for(var attr in feature.attributes){

alert(attr);

      }

}

 

Am I doing anything wrong?

Please help me out.

 

Thanks.

Regards,

Ela

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070926/aae47157/attachment.html


More information about the Users mailing list