Geoprocessing considerations for KML input

KML (formerly known as Keyhole Markup Language) is an XML-based file format for displaying information in a geographic context. KML information can be drawn in many earth-based browsers, including ArcGIS Earth and ArcGIS Pro. KML Version 2.2 has been adopted as an Open Geospatial Consortium (OGC) standard. The complete KML specification can be found at https://www.opengeospatial.org/standards/kml/.

You add KML information to maps and scenes the same way you add other data. The KML file is the source of the layer in the map or scene. You can use a .kml or .kmz (compressed) file, or a URL pointing to a KML file.

A single KML file can contain features of different geometry types and can even contain both vector and raster data. ArcGIS Pro draws all this content as a single layer. The KML settings defined in the source file are honored. You can navigate and explore the KML information, and change a few aspects of the layer's display, but you cannot modify the KML itself.

You can use KML directly as input to most geoprocessing tools that process feature-based data like shapefiles and geodatabase feature classes. This is accomplished in one of two ways:

  • Add a KML layer to a map and select the input layer from a list of map layers.
  • Use the path to the KML file, appended with the feature type.

Select KML layer from list of layers

If you have added a KML layer to your map, most geoprocessing tools that accept feature layers can also use the KML layer as input. To use the KML layer, select the name of the KML layer from the drop-down list of layers for the input parameter.

Select a KML layer from the drop-down list of layers for the input parameter

You will notice that the KML layer name is appended with one or more feature types. For example, your KML layer Wild Fire will display as Wild Fire\Points in the list of layers. Since a KML layer can contain multiple geometry types and geoprocessing tools only work with a class of homogeneous geometries, you must specify which features in the KML layer to process. Feature types include the following:

  • Points
  • Polylines
  • Polygons
  • Multipatches

After selecting the KML layer to process, the value in the input parameter will be transformed into the path to the KML file appended with the feature type for processing.

A KML layer is transformed to a KML path

KML file path

You can directly use a KML file path appended with the type of features as input to a feature-based geoprocessing tool. This is especially useful when running a geoprocessing tool from Python. The input parameter value must be formatted like C:\data\KML\Wildfires.kmz\Points.

Exceptions

Geoprocessing tools that modify or edit their input data cannot use KML as input. Examples include tools that add attribute fields or calculate attribute values such as Add Field or Calculate Field, and tools that modify the input geometry such as Densify or Transfer Attributes.

Additionally, the Make Feature Layer, Select Layer By Attribute, and Select Layer By Location tools cannot use KML layers or paths as input. To be able to select the features contained within KML by attributes or by location, you must convert the KML to geodatabase features using the KML To Layer tool.