[OpenLayers-Users] Couple of questions using WFS layer

Stephen Woodbridge woodbri at swoodbridge.com
Sun Feb 8 16:26:49 EST 2009


Hi all,

I'm making progress but can't find the attributes of the WFS features.

My goal is to load a WFS layer, pull the attributes into a div as a 
scrolling list of items and when you mouse over the item in the 
scrolling list have it highlight the feature on the map.

To start with, I'm approaching this backwards and just displaying the 
WFS and highlighting the features onHover over the map, with the idea 
that if I can grab the attributes and make a list, I can add onHover 
handler to the list items and have them select the feature. Any way that 
was my thought, but maybe there is a better way to do this.

I assume I can hook the beforefeatureadded or featureadded to extract 
the attributes and add them to the list in some div, assuming that I 
have access to the attributes which is a problem at the moment.

Thoughts and pointers to examples would be appreciated.

Anyway, missing attributes - the attributes are in the XML, but do not 
appear to be added to the features objects at least as far as I can tell 
but looking in the DOM with firebug. And adding to the selectFeature 
control:

onSelect: function (feature) {
   alert(feature.attributes["gid"]);
}

returns a undefined. Here is a link to the page:

http://imaptools.com/maps2/test.html

Once it loads and displays the vector layer, a hover will generate an alert.

Thanks,
   -Steve



More information about the Users mailing list