
OpenLayers 2.10 Beginner's Guide

In this example, we'll be using the cluster strategy, selectFeature control, and showing photo information on selection. As we go along, feel free to tweak the examples yourself, change the functionality, or anything else—that's the best way to learn!
Make a copy (or direct edit) of the code from the previous example. We'll be improving it.
We'll keep extractAttributes
and extractStyles
. Even though we specify extractStyles
, we're going to be using a custom styleMap
object. We're doing this so that we can still access the thumbnail image location (which is set as externalGraphic
in the feature's style
object when using extractStyles
). Make sure the format
object looks like the following:
... format: new OpenLayers.Format.KML({ extractAttributes: true, extractStyles: true }) …
Let's add a cluster
strategy to the vector layer now so our points cluster. Our strategies
array should now look like the following:
strategies: [new OpenLayers...
Change the font size
Change margin width
Change background colour