Common Styles

Common styles provide an FME-twist on providing styling for KML elements that allow arbitrary groups of FME features to share the same KML <Style> element. The goal of this feature is two-fold:

  • Make it trivially easy for arbitrary groups of features to share styling without having to manually create Style features.
  • Reduce the size of KML datasets by preventing the creation of inline Style elements.

This feature was primarily designed to support the KMLStyler transformer, but may have other applications.

To enable common styling, each feature in the group of features being styled must satisfy two conditions:

  1. They must have a kml_common_style attribute that is unique for the group
  2. They must have KML Style element attributes that define the styles for the group.

As each feature is added to its corresponding document, it is checked for the kml_common_style attribute. If the corresponding style does not exist yet, it is created from the feature's attributes, otherwise the feature's style attributes are ignored. It is very important to note that this is a "first feature wins" scenario, and unless you can guarantee the order in which the KML writer receives the features, you are better off ensuring that all features have the same style information.