Skip To Content

Authoring maps for publishing as KML

If you anticipate that users will access your map as KML, there are certain design patterns that you should follow. This topic also contains tips on how to prepare your ArcMap document so that particular features of KML are available. For example, when someone views your KML service and clicks a point, what appears in the pop-up window? Or, how can you create a high-performance service that uses KML Regions? These are examples of things that you need to set up during the map authoring phase before you publish the service.

What can you include in the map?

You can include both vector and raster layers in your map. Labels that you set on either of these feature types will also be included in the KML.

Once you publish the service, you can choose whether clients will be able to retrieve the actual vector features or whether they'll see rasterized images of the map. Similarly, you'll be able to choose whether the labels in your map are rasterized and lie flat on the globe or stand up on the globe and rotate when the user rotates the map (these are also known as billboarded labels).

Working with labels

Labels in your map are converted to KML. The label text is based on the field you choose on the Labels tab of the Layer Properties dialog box in ArcMap and ArcGlobe.

If you have disabled all fields and still choose to label features, the label text is based on the primary display field (for more on the primary display field, see Understanding field properties, aliases, and table display options in the ArcGIS Help).

The only label effects that are honored in KML are size and color. Labeling effects such as shadows and halos are not transferable to KML. Only one label can be applied per feature.

Setting up descriptions and snippets

Descriptions and snippets are two ways of providing attribute information in KML. The snippet is a short piece of text that describes something (like a title). The description is a longer explanation that can include text, links, pictures, and other media.

Descriptions determine what appears in the informational pop-up window that is displayed when you click a feature. Snippets define text that appears in the table of contents. Both descriptions and snippets can be applied at many levels: feature, layer, data frame, and network link levels.

Setting up the snippet

By default, snippets are not configured to appear. You can change this by unchecking Suppress default KML snippet behavior when publishing a KML network link in Manager. In this case, if a snippet is defined, it is used. Where no snippet is defined, the first two lines of the description are used.

If you choose to use snippets, they derive from a field in your data. You choose which field appears in the snippet by giving it the alias KMLSnippet on the Fields tab of the Layer Properties dialog box. You can only give one field this alias.

Setting up the description

You set up the description differently based on whether it will apply to the network link, data frame, layer, or individual feature.

  • The description for the network link is only configurable when you publish the service as a network link.

  • The description for the data frame is based on what's in the Description box on the General tab of the Data Frame Properties dialog box.

  • The description for layers is based on what's in the Description box on the General tab of the Layer Properties dialog box.

  • The description for individual features is formatted by the XSL style sheet that you specify on the HTML Popup tab on the Layer Properties dialog box in ArcMap and ArcGlobe. Some sample style sheets are included in <ArcGIS Installation location>\Styles\HTMLPopup.

    XSL style sheets allow you to use your feature attribute values to construct a pop-up window with any HTML. For example, you could create a link to a geoprocessing task result that returns KMZ, using the attribute values to define the model parameters. This allows you to access real GIS in a KML browser environment. You can also link to the results of layer queries in a similar way, using attribute values as query parameters. Additionally, you can display images or Flash videos referenced by an attribute in your feature. In summary, you can link to any HTML content on the web.

    KML from queries or geoprocessing tasks only use the pop-up window if all fields are returned. If you were to return only a subset of fields, the style sheet could be referencing fields that don't exist, causing unexpected behavior. If all fields are not returned, a simple HTML table of field names and attribute values is returned.

Long and complex descriptions can cause slower performance in KML client applications. Avoid long descriptions if performance is an issue. To shorten your descriptions, consider including a simple link to a web page that contains the same material.

If your feature density is high and your style sheet is complicated, remember that the style sheet is applied for each feature, and performance may become an issue.

Extruding features

If you want to publish feature classes with 3D attributes, such as z-offsets, or extrude features based on attributes, you must first edit the feature class layer properties in ArcGlobe, save the feature class as a layer file, then add the layer file to an ArcMap document.

For example, suppose you have a polygon feature class with a population density field. You want to display this feature class in 3D KML such that polygons with high population densities "pop out," or are extruded more. To do this, set the extrusion properties for the feature class in ArcGlobe, save the feature class as a layer file, then add the layer file to an ArcMap document. You won't see any of the elevation or extrusion effects in ArcMap, but the published KML has a 3D appearance.

For a walk-through of this process, see Tutorial: Publishing a KML service.

Setting up the legend

You can make a legend available that describes the layers in your KML service. ArcGIS Server searches the layout view of your map document for any legends that are present. If legends are found, they are embedded in the KML.

Legends are dynamic and will be updated if you change the symbology of any of your map features or the scale of your map (for layers with scale ranges set). Do not convert your legends to graphics or they won't be embedded in the KML.

Each legend appears in the KML as a screen overlay. This means that it stays visible on the screen as the user pans and zooms the map. The user can choose where the legend will be placed on the screen from a folder of cardinal locations (for example, north, northwest, or west).

Tip:

If you'll just be using this map for KML, you don't have to worry about the positioning of the legend in the layout view of ArcMap.