Hi,<br><br>Doing it the way you said (directly underneath the feature creation) does work, but i want to move the feature attributes extraction to a separate function like so:<br><br>function extractDetails() {<br> var feats =
polygonLayer.features; // This is the Layer.Vector<br> for(item in feats) {<br> atts = item.attributes;<br> <br> // do stuff depending on attributes <br>
}<br>}<br><br>the problem is that atts never has any properties (you can never call atts.<anything>), is the above approach completely wrong ??<br><br>Thanks,<br><br>Andy<br><br><div><span class="gmail_quote">
On 11/10/2007, <b class="gmail_sendername">Christopher Schmidt</b> <<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Thu, Oct 11, 2007 at 09:17:06AM +0200, Andy Dale wrote:<br>> "An optional object that will be mapped to the<br>> attributes<<a href="http://dev.openlayers.org/docs/files/OpenLayers/Feature/Vector-js.html#OpenLayers.Feature.Vector.attributes">
http://dev.openlayers.org/docs/files/OpenLayers/Feature/Vector-js.html#OpenLayers.Feature.Vector.attributes</a>>property."<br>><br>> So I attempted to set the second parameter in a varity of ways such as:<br>
><br>> 3) {first: "test", second: 21};<br><br>This is the right one.<br><br>><br>> I attempt to access the attributes as follows:<br>><br>> 1) Call Layer.Vector.features<br>> 2) Iterate over the returned features
<br>> 3) On each feature call Feature.attributes<br>> 4) Try and access the attributes<br><br>This should work.<br><br>f = new OpenLayers.Feature.Vector(geometry, {'a':'b'});<br>alert(f.attributes.a);
<br><br>Should do the trick. Is it not working for you?<br><br>Regards,<br>--<br>Christopher Schmidt<br>MetaCarta<br></blockquote></div><br>