HOW TO

Export feature layer to KML with subfolders using values in ArcGIS Pro

First Published: April 13, 2026
Last Published: May 11, 2026

Summary

In ArcGIS Pro, the Layer To KML tool exports a feature layer to Keyhole Markup Language (KML) without organizing features into folders based on field values. By default, features in the layer are placed in a single folder unless the hierarchical structure is defined before export. Creating a well-structured folder hierarchy, such as subfolders, improves usability when the KML data is viewed in ArcGIS Earth or Google Earth Pro.

The Data tab below shows the exported KML with the features organized into a single folder in ArcGIS Earth.

All features organized into a single folder on the Data tab

This article provides the workarounds to export a feature layer to KML with subfolders using field values in ArcGIS Pro.

Procedure

Create a FolderPath field and populate values using the Calculate Field tool

  1. In ArcGIS Pro, open the project.
  2. Add a new field named FolderPath with a text data type to the attribute table.
  3. Use the Calculate Field tool to populate values in the new field.
  1. Open the attribute table of the feature class, right-click the header of the new field, and click Calculate Field.
  2. In the Calculate Field window, for Expression Type, ensure the default Python option is selected from the drop-down menu.
  3. For Expression, copy the code below and paste it in the expression box. Replace <fieldName> with the original field name. In this example, the original field is ParcelStatus.
“/” + !<fieldName>!
The Calculate Field window
  1. Click Verify The Verify icon to validate the expression.
  2. Click Apply > OK.
The values populated in the FolderPath field
  1. Export the layer to a KML file. Refer to ArcGIS Pro: Layer To KML (Conversion) for more information.
Note:
Optionally, delete the new field or undo the field calculation after the export to prevent the Layer To KML tool from continuing to parse folders based on the field.

The Data tab below shows the field values in separate folders in ArcGIS Earth.

The field values are in separated folders on the Data tab

Use the Split By Attributes tool and group the layers

  1. In ArcGIS Pro, open the project.
  2. On the Analysis tab, in the Geoprocessing group, click Tools.
  3. In the Geoprocessing pane, search for and click Split By Attributes (Analysis Tools).
  4. Use the Split By Attributes tool to create separate layers for each unique field value. The output lists all attribute values as individual layers under the Databases folder.
The Split By Attributes pane
  1. Add the layers created in Step 4 to the current map.
The layers are listed in the Contents pane
  1. In the Contents pane, create a group layer to group the layers. Refer to ArcGIS Pro: Work with group layers for instructions. In this example, the group layer is renamed polygon_test1.
The layers are grouped as a group layer
  1. Export the layer to a KML file. Refer to ArcGIS Pro: Layer To KML (Conversion) for more information.
Note:
Features with null or blank values in the field are not exported to KML.

The Data tab below shows the field values grouped into separate folders as group layers in ArcGIS Earth.

The field values are grouped into separate folders as group layers on the Data tab

Article ID: 000041219

Software:
  • ArcGIS Earth
  • ArcGIS Pro

Get support with AI

Resolve your issue quickly with the Esri Support AI Chatbot.

Start chatting now

Get help from ArcGIS experts

Contact technical support

Start chatting now

Go to download options