[OpenLayers-Users] Labeling clustered features

Florian Diederichs florian_diederichs at hotmail.com
Fri Sep 4 10:44:59 EDT 2009


Hi Andreas,

thanks a lot for the tip, although now that i know, i'm feeling a bit bad
because i didn't figure that out by myself ;)

Regards
Florian


Andreas Hocevar-2 wrote:
> 
> Hi Florian,
> 
> if your application is based on the stragety-cluster example, then you
> won't have the count in your context. If you provide a context in your
> Style objedt, you don't have direct access to feature attributes. So
> your context should look like this:
> 
> context: {
>     radius: function(feature) {
>         return Math.min(feature.attributes.count, 7) + 3;
>     },
>     count: function(feature) {
>         return feature.attributes.count;
>     }
> }
> 
> Regards,
> Andreas.
> 
> Florian Diederichs wrote:
>> Hello,
>>
>> thanks for replying, i guess i should have mentioned, that i copy the
>> attributes from the features to the clusters.
>>
>> However the attribute i wanted to use as the label is the
>> 'cluster.attributes.count' which is there by default anyway, when i
>> remember
>> correctly. So in my case, the clusters do have 'feature.attributes.count'
>> as
>> a property/attribute, at least i can see it in firebug.
>>
>> I hope i didn't get you wrong though.
>>
>> Thanks in advance
>> Florian
>>
>>   
> 
> 
> -- 
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/Labeling-clustered-features-tp3579005p3580415.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list