Creating KML in ArcGIS for Desktop

Creating KML in ArcGIS for Desktop is an easy process involving three primary steps:

  1. Author layers and maps in one of the ArcGIS for Desktop applications: (ArcMap, ArcGlobe, and ArcScene).
  2. Prepare the layers and maps to be converted to KML by setting certain properties and data attributes that will ensure the KML created matches your requirements and is user-friendly and well-formed.
  3. Create the KML file using one of the KML conversion tools: Layer To KML or Map To KML. You can also create KML from your 3D multipatch feature classes using the Multipatch To COLLADA tool.

Author layers and maps

Both feature and raster layers and ArcMap map documents (.mxd) can be converted to KML. Before they can be converted to KML, feature classes or raster datasets must first be added to the display (automatically makes a layer from the dataset) or made into a layer using the Make Feature Layer or Make Raster Layer tools.

KML created in ArcGIS for Desktop represents a snapshot of the layers and maps at the time they were converted to KML. How your layers look in ArcGIS for Desktop will for the most part match how they will look as KML; for example, if you want the KML to have a certain symbol or color, work in ArcMap to give the map layer the desired symbology, then export it to KML.

Preparing layers and maps to be converted to KML

Layers

Many different aspects and properties of layers authored in ArcGIS for Desktop are applied to the KML during conversion, including visible attribute fields, transparency, labels, pop-up displays, and symbology. By setting layer properties and data attributes you can ensure that the KML you create matches your requirements and is user-friendly and well-formed. Except where noted below, the rule of converting a layer or map to KML is what you see is what you get. The following table shows a number of things you can do to prepare your layers for conversion to KML.

Layer properties and KML conversion

Property

Appearance

Description

Layer name

KML name

A feature layer in ArcGIS becomes a folder in the KML. The layer name will be used as the KML folder name.

Layer description

Folder pop-up display

The layer description will be used as the pop-up display content for the folder.

Layer symbology

KML symbology

The layer symbology will be used as the KML symbol.

For feature layers, not all ArcGIS symbols are supported in KML. For line features, only simple symbols with basic color and line width properties are supported; advanced effects such as dashes and arrows and multilevel or layered symbols are not supported. For polygon features, only simple color fills with simple line borders are supported; no patterned, hatching, or gradient fills are supported, and the same rules for lines apply to polygon borders. If you require more than simple symbols for your features, use the Return single composite image parameter of the Layer To KML or Map To KML tools to convert the symbolized features into a raster image that maintains complex symbology.

Feature name

KML feature name
Block group FIPS code used as name

If feature labels are turned on, the layer's label field or expression will be used for the name. If labels are not turned on, the layer's display field or expression will be used for the name. If neither of these layer properties are set, values from a field named Name will be used for the name.

Feature label

KML feature label

When layer labels are turned on, the layer label field or expression will be used to name each KML feature and labels will be turned on.

NoteNote:

Only point features will be labelled. For line of polygon features, centroids can be created and labelled to achieve a label effect.

Feature snippet

KML feature snippet

The snippet of a feature can be set by changing the alias of an existing field to KMLSnippet. Alternatively, values in the feature layer's Snippet field will be used as the snippet of each feature in the KML.

Feature pop-up display

KML balloon

By default, the pop-up display will be composed of all visible fields from the layer. KML feature pop-up displays can also be set using the layer HTML pop-up properties. If the layer HTML pop-up displays are turned off, the values in the feature layer's PopupInfo field will be shown in the pop-up display when a KML feature is clicked. These values can be numeric or text attributes as well as HTML-formatted code stored in a text field.

Folders and subfolders

KML subfolders
The values in the FolderPath field are like Block Groups/Year/2010.

If the layer has a field named FolderPath, the values in that field will be used for defining the KML folders and subfolders. Within that field the path separator between folders and subfolders must be a forward slash ( / ). If the layer does not have a FolderPath field you can define a folder and subfolder structure by using group layers. Specify the group layer itself as the input to the Layer To KML tool to get the group layer structure in the KML.

Feature elevation

3D KML

KML will be created in 3D if the feature layer is z-enabled and has z-values in the geometry. Also when a layer has 3D display effects applied in ArcGlobe or ArcScene (base height or extrusion), those 3D effects will be maintained in the output KML. If none of these layer effects are applied, field attributes are used to control 3D effects. For a detailed explanation, see the following section on 3D creation.

Layer properties and KML conversion

3D creation

The following field attributes (all of type integer) are used to control the placement and properties of features in the 3D space (on top of or floating on a surface).

CautionCaution:

KML uses the WGS84 coordinate system and meters for the unit of measurement. All elevation values are assumed to be in meters when creating KML.

Layer properties for 3D conversion

Field

Value

Explanation

AltMode

0 or -1

A value of 0 sets the height to the KML setting of absolute and should be used when your features are z-enabled. A value of -1 places your features relative to the surface of the earth.

Base

Any numerical value

Any numerical value can be used. When this value is used with a relative placement (AltMode=-1), the value controls the height of the features above the earth's surface.

CautionCaution:

If your features have a z-value of 100, and are in a geographical area where the earth's surface is higher then 100, an absolute setting will cause your features to be placed under the surface of the earth.

Extruded

0 or -1

A value of 0 sets no extrusion, while -1 creates an extrusion effect. Extrusion of features makes polygons look like blocks with their sides continuing down from the polygon into the earth's surface.

The green polygons in the back left of the following screen capture are features without elevation, or Z-values, while the red and gray features in the front right have elevation values. Similar effects can be applied to features with and without z-values. For example, the green extruded polygon has no z-values and the following fields set: AltMode = -1, Base = 25, and Extruded = -1. The extruded red polygon has a z-value of 1300 and the following fields: AltMode = 0, Base = 0, and Extruded = -1. Because the red feature has an elevation value, its position is set to absolute, and only extrusion is used.

Controlling 3D behaviors
NoteNote:

The optional parameter on the Layer To KML tool, Clamped features to ground, will override 3D settings and all your features will be draped on the earth's surface. This parameter is useful when creating KML from features with z-values below the earth's surface and 3D effects are not required. Alternatively, using a field named Clamped with a setting of -1 will produce the same effects as using the optional parameter on a per-feature basis.

Maps

There are also map properties that you can use to control how map documents converted to KML will look and behave. The following table shows a number of things you can do to prepare your maps for conversion to KML.

Map properties and KML conversion

Setting

Appearance

Description

Map data frame name

KML name
The data frame selected to be converted to KML was New Orleans Admin. The data frame had two layers: Block Groups and Municipalities.

Only a single data frame can be exported to KML at a time. The map data frame name will be used as the top name in the KML.

Map data frame description

KML balloon

The data frame description will be used as the pop-up display content for the top KML item.

Legend

KML screen overlay legend

A legend is the only screen overlay that you can include in your KML created in ArcGIS for Desktop. Legends added in the map document layout view will be included as a KML screen overlay and a button folder that allows you to change where the legend will be displayed on the screen. Legend overlays will only be included in the KML when using the Map To KML tool.

Map properties and KML conversion

Create the KML file

There are two geoprocessing tools available for creating KML files from ArcGIS data: Layer To KML and Map To KML. Both tools create a KMZ (compressed KML) file in the output location. Additionally, the Multipatch To COLLADA tool creates a related KML file when converting from a multipatch feature class to COLLADA files.

Layer To KML

The Layer To KML tool allows individual layers to be exported directly from ArcMap, ArcGlobe, or ArcScene.

Layer To KML tool dialog

Map To KML

The Map To KML tool allows multiple layers in an ArcMap map document data frame to be simultaneously exported to a KML file. Each layer will be maintained as a distinct folder in the KML, unless the option is used to convert all layers to a single flattened image.

Map To KML tool dialog

Multipatch To COLLADA

The Multipatch To COLLADA tool can be used to export multipatches to COLLADA files on disk. COLLADA is a 3D model format that is supported in many 3D applications, including Google Earth. If the multipatch feature class you are converting is in a projected coordinate system, the tool will create a KML file in the output folder which will assign geographic coordinates to the 3D models in the COLLADA files.

Learn more about multipatches

Related Topics

3/3/2014