Using folders to organize KML content

KML allows you to define folders within a KML file. These folders allow browsing of the KML contents in a tree structure control, similar to Windows Explorer. Folders can be useful for logically grouping KML elements together in the KML contents view. KML files that leverage organizational folders can also improve GIS data accessibility—they allow users to navigate content via a structured table of contents rather than relying solely on the geographic representation.

When creating or serving KML from ArcGIS, folders are automatically created to group and organize content. Layers that display their features as vectors or placemarks have a separate subfolder within the KML file, exposing each individual feature as a separate child element.

However, these automatically created folders may not be organized hierarchically to allow easy navigation through the KML contents tree. One problem might be that there are simply too many features exposed within a single folder, with an enormously long item list. Another problem might be that there is a logical, attribute-based tree structure inherent within the data that needs to be exposed, such as a set of historical data with distinct time slices.

In these cases, group layers can be leveraged to define organizational folders that contain and classify the automatically defined placemark features, feature layers, and ground overlays.

Case study for enhancing the KML folder structure

Germany has more than eight thousand postcode areas, and exposing all these features in the same KML folder would effectively render the KML contents tree unusable.

Germany's Postcode Areas
Germany's Postcode Areas

However, by logically grouping the postcode areas into regions and zones, the same number of features can be shared as KML without impairing the use of the table of contents listing. Given that German postcodes are grouped into local regions and then into one of ten national zones, the data can be logically broken down into a two-level hierarchy of folders.

The workflow to do this is detailed below.

  1. Create a new group layer and set its name to Germany Postcode Areas.
    Add a new group layer.
  2. Create another group layer, set its name to the first available zone, then place it as a subfolder of the top group layer.
  3. Add the polygon postcode data and use a Definition Query to limit the features displayed for that layer to be a single zone/region combination.
    Set the Definition Query for the layer.
  4. Set the layer name for the polygon layer to the name of the region.
  5. Repeat the above three steps until all combinations of zone and region have been included.
    Table of contents with two levels of nested group layers
  6. Export the layer to KML.
    Fill in the Layer To KML geoprocessing tool and click OK.

The result of this process is more interactive data, which the user can investigate through either the geographic locations on the map or the folder hierarchy.

GIS data displayed in a folder structure in Google Earth
Image courtesy of Google Earth

1/21/2011