Hi,<br><br>I installed firebug, and managed to track down the cause of my error.<br><br>It seems the for loop causes the problem, the following does not work:<br><br>function extractDetails() { <br> feats = polygonLayer.features
;<br><br> for(item in feats) {<br> alert(item.attributes.first);<br> }<br> }<br><br>but this does:<br><br>function extractDetails() { <br> feats = polygonLayer.features;<br>
<br> for(i = 0; i < feats.length; i++) {<br> alert(feats[i].attributes.first);<br> }<br>}<br><br>maybe i have got a bit confused over what is possible in wit for loops in javascript ?
<br><br>Cheers,<br><br>Andy<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 02:41:05PM +0200, Andy Dale wrote:<br>> Hi,<br>><br>> Doing it the way you said (directly underneath the feature creation) does<br>> work, but i want to move the feature attributes extraction to a separate
<br>> function like so:<br><br>This should (in general) work. Do you have firebug? Have you looked at<br>the properties of the features on the layer to see what they have? This<br>is a very useful to see what's actually there.
<br><br>If you open the Firebug console and type<br>polygonLayer.features[0].attributes, is there anything there? Adding<br>things to the Layer.vector does not at all change their attributes<br>property at all, so I can't imagine where this is getting lost.
<br><br>Regards,<br>--<br>Christopher Schmidt<br>MetaCarta<br></blockquote></div><br>