Style
One of KML's primary strengths is simple support for visualizing and styling geographic features. However, the current mechanism used in KML 2.2 requires specifying they style in each Placemark, causing some criticism about mixing data and style.
One concept that is being considered is adopting a CSS mechanism for styling the geographic features. In fact, CSS3 supports many concepts that would apply well to KML and is understood and used by the broader public. By using CSS, developers can reference elements by class or id, or use selectors as supported in CSS3: Folder#roads .interstate {}
CSS also offers the ability for developers to define their styles once, and then reference these styles from any number of KML documents. In addition, KML client applications could allow users to apply their own, overriding styles that would apply specific styling to all KML as desired.
We're also looking at how to create styles based on Metadata. CSS3 supports styling based on evaluating attributes of elements such as: Placemark[title^="Picnic"], which would find any Placemark with a title attribute that begins with "Picnic".
More work must be spent evaluating if CSS offers at least the same support currently offered by KML 2.2 styling and provides compelling additional features. Also, this must be compared to SLD - though SLD is much more complex and perhaps unapproachable by "agile geographers".
roadstyles.kss
<kstyle>
Placemark {
font-size: 8px;
}
#roads {
color: blue;
width: 2px;
}
.secondary {
width: 1px;
}
Placemark[num_lanes=2] {
width: 2px;
}
</kstyle>
virginia_roads.kml
<kml>
<Schema></Schema>
<styleUrl>http://mygeosite.com/roadstyles.kss</styleUrl>
<Folder id="roads">
<atom:name>VDOT</atom:name>
<Placemark class="primary" id="I66">
<link type="ogc/wfs" href="http://mygeosite.com/roadstyles.wfs#I66"/>
<num_lanes>4</num_lanes>
<road_type>asphalt</road_type>
<gml:Point>
<gml:pos>42, -83, 100</gml:pos>
</gml:Point>
</Placemark>
</Folder>
</kml>
utah_roads.kml
<kml>
<styleUrl>http://mygeosite.com/roadstyles.kss</styleUrl>
<Folder id="roads">
<atom:name>UDOT</atom:name>
<Placemark class="secondary myfavoriteroad three_lane_road" id="U78800">
<num_lanes>2</num_lanes>
<road_type>gravel</road_type>
</Placemark>
<Placemark></Placemark>
</Folder>
</kml>
