Styles - The Spring Collection
Styles are used to define how Geometry and Description Balloons appear when KML is rendered. They define colors, sizes, opacity and Placemark icons used. They can also control how Containers (Documents and Folders) appear in the Google Earth sidebar.
KML: Styles
Basic Editing of Styles
Styles can be edited directly in Google Earth, by right-clicking on the object (in the sidebar) and selecting Properties (or Get Info on Mac). This opens a "dialog box". If all editing of styles is done within Google Earth, but the code is eventually saved and viewed using a text editor, there will be a lot "redundant" code (styles that are duplicated or no longer used by objects in the file).
XML identifier (ID)
This can be thought of as a name or signature that uniquely identifies one KML element. Each block of <Style> is identified in this way: <Style id="NameHere">. This enables sharing of individual styles by multiple objects, which reference them using <styleUrl>. All KML objects can have an XML ID attached to them.
Sub-Styles
A number of sub-styles can be defined within the style element:
<IconStyle> defines how the icons for Point-Placemarks are drawn in the 3D viewer and in Places in the sidebar.
<LabelStyle> defines how the label for an object (which uses <name>) appears in the 3D viewer.
<LineStyle> defines how line geometry is drawn. This includes LineStrings and the edges of Polygons.
<PolyStyle> defines how polygons appear.
<ListStyle> defines how a feature appears in Places in the sidebar.
Rollover Effects
KML Styles can be used to show different sized or colored geometry, or a different icon, when the cursor is rolled over the object in the 3D viewer.
<StyleMap id="NameReferencedByObject">
<Pair>
<key>normal</key>
<styleUrl>#StyleId1</styleUrl>
</Pair>
<Pair>
<key>normal</key>
<styleUrl>#StyleId2</styleUrl>
</Pair>
</Style>
The id of <StyleMap> is referenced by the <StyleUrl> of the object using the rollover effect.
Links
Getting Started With Styles
Google Tutorials
Brief guides explaining Styles for Geometry and Styles for Highlighted Icons.
KML Tutorial
Tutorial created for Google Earth workshops taught by UAF's Geography Department introduces Styles.
KML Examples
Sample set of data showing locations of thermal hotspots and their volcanic and non-volcanic causes that are identified by the use of rollover icons.


