Data

KML files available for free download

Description

This is a warehouse of KML <Style> elements that can be referenced from other files, as described in the KML Reference.

The following notes can prevent hours of headache inducing frustration and copius emission of expletives!

  • IMPORTANT! Only <Style> elements can be referenced externally; <StyleMap> elements (if used) must be within the target .kml file.
  • IMPORTANT! The URL to the source style file must be http://, not https://.
  • IMPORTANT! The source style file must have a .xml extension, not .kml, as one might expect.
  • IMPORTANT! Google Earth will only load the source style file once. Clearing the application cache will not refresh the file. Google Earth must be closed and restarted to fetch the latest version.
  • The source file requires only the KML namespace declaration; references to Atom and other namespaces are typically not needed.
  • Google Earth does not preserve external style references when copy/pasting features. GE copies the styles locally to the file instead of pointing to the original StyleMap, again increasing bloat.
  • Example external style file:
    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2">
    <Document>
      <Style id="sn_windTurbine">
        <IconStyle>
          <scale>0.7</scale>
          <Icon>
            <href>http://scottmurray.me/kml/data/icons/wind_turbine.png</href>
          </Icon>
        </IconStyle>
        <LabelStyle>
          <color>ffffff00</color>
          <scale>0</scale>
        </LabelStyle>
      </Style>
    </Document>
    </kml>
  • Example code referencing the external style:
    <Placemark>
      <name>Wind Turbine</name>
      <styleUrl>http://scottmurray.me/kml/data/styles/wind_turbine.xml#sn_windTurbine</styleUrl>
      <Point>
        <extrude>1</extrude>
        <coordinates>-120.182958,45.918314,10</coordinates>
      </Point>
    </Placemark>

Naming conventions:

  • As per Google's convention, prepend "sn_" to normal styles
  • As per Google's convention, prepend "sh_" to highlight styles
  • As per Google's convention, prepend "msn_" to stylemaps

Directory

table goes here

Notes

See also: