-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

OpenLayers 2.10 Beginner's Guide

The extractStyles
can be used to style the vector layer based on the styles specified in the KML file. Because the Flickr KML file provides style information, we can use this property—let's see how.
If the KML file you are working with contains style information, we can directly access and use it. In this case, Flickr is providing us with a KML file embedded with style tags, so let's use it.
We'll specify extractStyles: true
inside our vector layer creation call. In the format value setting, add it in, and be sure to include the comma:
... format: new OpenLayers.Format.KML({ extractAttributes: true, extractStyles: true }) ...
Now open the page and you should see thumbnails of the images:
Using extractStyles
, our features went from the default orange dots to thumbnails of the actual uploaded photos. When this property is used, style definitions in the KML file are applied to the
style...
Change the font size
Change margin width
Change background colour