Question
What are KML Folders and how do I set them up?
Answer
KML Folders Definition
KML Folders define the nested tree structure in the Google Earth Places pane. This tree control helps organize data presentation to the user so they can turn on and off layers of interest. It also helps group features together so the user isnt presented with a list of thousands of features. For example, instead of a hundred different zoning types, you might want to organize your zone features into zone categories such as commercial, residential, industrial, transportation and open space.
KML Folders: Approaches in FME
FME allows you to create KML folder structures in two ways:
1. Feature Type Fanout Approach
By default the writer creates a simple one level folder structure when you use a feature type fanout. To avoid a long list of features in the legend you should also consider aggregating by some useful class attribute.
2. KML IDs Approach (kml_parent and kml_id)
If you need to define a custom folder heirarchy with direct control over folder naming, parent - child relationships and folder levels as deep as you want, then you need to create folder elements and associate all your features with their appropriate folder. To do this you need to create a destination feature type within the same KML document called Folder. Use a Creator to make one null geometry record for each folder, then set kml_id to the folder name, and kml_document to the KML dataset name. To nest folders create a folder feature as above but add a kml_parent set to the parent folder name. To assign your geographic features to any of these folders simply set the kml_parent to be any of the folder names you created above.
See the attached workspace for an example of how to create folders with both approaches described above. Note that for approach 2 I had to set kml_document because I am using Creators. Normally kml_document would be set to the fme_basename by default when reading from a dataset. Note that using the second approach disables any folder creation that would otherwise occur from setting the feature type fanout.