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>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var feats = 
polygonLayer.features; // This is the Layer.Vector<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for(item in feats) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; atts = item.attributes;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; // do stuff depending on attributes &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>}<br><br>the problem is that atts never has any properties (you can never call atts.&lt;anything&gt;), 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> &lt;<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>&gt; 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>&gt; &quot;An optional object that will be mapped to the<br>&gt; attributes&lt;<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>&gt;property.&quot;<br>&gt;<br>&gt; So I attempted to set the second parameter in a varity of ways such as:<br>
&gt;<br>&gt; 3) {first: &quot;test&quot;, second: 21};<br><br>This is the right one.<br><br>&gt;<br>&gt; I attempt to access the attributes as follows:<br>&gt;<br>&gt; 1) Call Layer.Vector.features<br>&gt; 2) Iterate over the returned features
<br>&gt; 3) On each feature call Feature.attributes<br>&gt; 4) Try and access the attributes<br><br>This should work.<br><br>f = new OpenLayers.Feature.Vector(geometry, {&#39;a&#39;:&#39;b&#39;});<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>