<div dir="ltr"><div style>something along the lines (I just cut and copied some of my code here so you have to modify it for your needs):</div><div><br></div><div>                            for (var i=0; i<event.feature.cluster.length; ++i ) {</div>
<div>                                try {</div><div>                                        message += makeLink(event.feature.cluster[i].attributes['name'],event.feature.cluster[i].attributes['description']);</div>
<div><br></div><div>                                   </div><div>                                } catch(e) {</div><div>                                        //</div><div>                                };</div><div>                            }</div>
<div><br></div><div><br></div><div style>HTH</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 19, 2013 at 1:27 PM, Frederick Löbig <span dir="ltr"><<a href="mailto:frederick.loebig@live.de" target="_blank">frederick.loebig@live.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr"><div><div>Hey list,</div><div><br></div><div>I have a question on the OpenLayers Cluster strategy and displaying attributes:</div><div><br></div><div>The situation: I have a map loading quite a number of points from a dynamically generated GML. Currently, I am not using a cluster strategy, but the handling gets more and more difficult. When I hover the points, I send the <a href="http://feature.attributes.Name" target="_blank">feature.attributes.Name</a> content (Content of the Name attribute in the GML) to a function for displaying a tooltip. No problem until I want to cluster the features. I understand, that after clustering, the attribute "Name" doesn't exist anymore. What I want to do now is, when it is a cluster of more than one feature, I want to send "Cluster of feature.attributes.count" to my tooltip function, which is also not a problem, but, if there is only one feature in the cluster, I want to send the <a href="http://feature.attributes.Name" target="_blank">feature.attributes.Name</a> of that feature to the tooltip function. I hope you understand what I am trying to achieve. </div>
<div><br></div><div>Here are the code fragments I am using at the moment:</div><div><br></div><div>--- The layer is generated with the following function (already including the cluster strategy): ---</div><div><br></div><div>
...</div><div><br></div><div>pointLayer = new OpenLayers.Layer.Vector("Wasserhäuschen", {</div><div>            strategies: [new OpenLayers.Strategy.Fixed(), new OpenLayers.Strategy.Cluster()],</div><div>            attribution:"Dateneigentum: <a href='<a href="http://www.linie11.org" target="_blank">http://www.linie11.org</a>' target='_blank'><a href="http://linie11.org" target="_blank">linie11.org</a></a> <a href='<a href="http://www.l-11.de" target="_blank">http://www.l-11.de</a>' target='_blank'><img src='./img/l11_attr.png' border='0'></a><br><br>",</div>
<div>            protocol: new OpenLayers.Protocol.HTTP({</div><div>                url: "./geoData/data.xml.gml",</div><div>                format: new OpenLayers.Format.GML()</div><div>            }),</div><div>
<span style="white-space:pre-wrap">                     </span>styleMap: new OpenLayers.StyleMap({'default':defaultStyle,</div><div>                                                           'select':selectStyle,</div><div>
                                                           'temporary':tempStyle</div><div><span style="white-space:pre-wrap">                                                                                        </span>},{</div><div>                context: {</div><div>                  // ...</div>
<div>                  label: function(feature) {</div><div>                    // clustered features count or blank if feature is not a cluster</div><div>                    return feature.cluster ? feature.cluster.count : "";  </div>
<div>                  }</div><div>                  // ..</div><div>                }</div><div><br></div><div><span style="white-space:pre-wrap">                       </span>})});</div><div><br></div><div>...</div><div><br></div><div>--- EOF ---</div>
<div><br></div><div>--- The code of the hover listener, that sends the data to the function openToolTip: ---</div><div><br></div><div>...</div><div><br></div><div>                var highlightCtrl = new OpenLayers.Control.SelectFeature(</div>
<div>                    pointLayer,</div><div>                    {</div><div>                            hover: true,</div><div>                            highlightOnly: false,</div><div>                            clickout: false,</div>
<div>                            toggle: false,</div><div>                            multiple: false,</div><div>                            renderIntent: "select",</div><div>                            overFeature: function(feature) {</div>
<div>                                    console.log('hover out:  ' + feature.attributes.count);</div><div>                                    openToolTip('Cluster of ' + feature.attributes.count);</div><div>
                            },</div><div>                            outFeature: function(feature) {</div><div>                                    console.log('hover out:  ' + feature.attributes.count);</div><div>
                                    closeToolTip();</div><div>                            },</div><div>                    }</div><div>                );</div><div><br></div><div>...</div><div><br></div><div>--- EOF ---</div>
<div><br></div><div>To my understanding, I somehow need to access the attributes of the feature selected. But I have absolutely no idea how to do this, and I hope to get a little help from you guys!</div><div><br></div><div>
Thanks in advance,</div><div>Freddy</div></div>                                           </div></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Best Regards,<br>
<br>Christian Ledermann<br><br>Nairobi - Kenya<br>Mobile : +254 702978914<br><br><*)))>{<br><br>If you save the living environment, the biodiversity that we have left,<br>you will also automatically save the physical environment, too. But If<br>
you only save the physical environment, you will ultimately lose both.<br><br>1) Don’t drive species to extinction<br><br>2) Don’t destroy a habitat that species rely on.<br><br>3) Don’t change the climate in ways that will result in the above.<br>
<br>}<(((*>
</div>