Creating KML files with Attribute Data

A Keyhole Markup Language (KML) file is a great way to view GIS data outside of ArcMap. Although there are many different ways to package and make data available, KML provides a simple format that can be viewed in a myriad of applications and can also be easily distributed to others.


Map layers can be converted to KML through the tools within the To KML toolset (ArcToolbox > Conversion Tools > To KML).



Although the tools within this toolset produce a KML quickly, the output lacks attribute data if not set up correctly. As in the example below, the KML only has the feature name. The name comes from the label expression of the ArcMap layer.



As you can see in the following screen shot, the Major Lakes Feature Class has some valuable attribute data that could be helpful if added to a KML file.



Steps to Add Attribute Data to KML Files
1. Open Layer Properties of the layer to be converted to KML.
2. Click on the HTML Popup Tab
3. Check “Show content for this layer using the HTML Popup tool 4. Select the desired HTML formatting.
    a. The table of visible fields is the default option and best for HTML content embedded inside geodatabase fields.
    b. The URL is best for pointing features at a set of predefined HTML pages.
    c. The formatted page based on an XSL template is best for advanced formatting.
5. Verify the HTML format.



A HTML Verification window will display an example of the popup.



Once you have the desired results, proceed to use either the Layer to KML tool or the Map to KML tool to create the KML file.



After you add the KML file to your application, you can see the added attributes for the features by clicking on it.



For additional information on KML, please see the following resources:


Learn More about KML
Preparing your map documents in ArcGIS for KML publishing
Layer to KML (Conversion)
About KML support in ArcGIS
Setting HTML pop-up properties for feature layers


-Timothy H., Support Analyst – Geodata Raster Group, Esri Support Services – Charlotte, NC



This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

7 Comments

  1. mmillard says:

    This is great, Timothy. Thanks. Perhaps I’m doing something wrong with respect to labelling. When I label points, I am able to make the label text “visible” on the GE side, even though it doesn’t come across right away in the conversion. But I don’t seem to be able to show labels at all in GE when lines or polygons are labelled in ArcMap. I’m using 9.3.1.

    Thanks.

    Matt Millard

  2. thales007 says:

    Hi Matt,

    Adding HTML popups to a KML is different than labeling KML features. The HTML popup is an interactive method for displaying attribute information when the feature is clicked. Labeling polygons or polylines is not currently supported for KML. As an alternate method you can use the Feature to Point tool to convert the features to points. With these points create the desired label and set the symbology to no fill color and no outline. Then convert the point layer to KML to display the labels on top of the polygons and polylines. Note that the label will be static in reference to the point location. I hope this information is helpful.

    Thanks.
    Timothy

  3. mmillard says:

    Yeah, I had thought about that, but I was hoping it wasn’t the solution.

    Thanks.

    Matt

  4. sgavathe says:

    Is there any way to connect to secured ArcGIS Server services and get the KMZ or KML working using token or username/password.

    I can’t see any reference on connecting to secured services for KMZ or KML. Any help is appreciated.

    thanks,
    shail_gis

  5. thales007 says:

    Hi Shail_gis,

    I am not familiar with accessing secured services for KMZ or KML. You might start a discussion on the forums: http://forums.arcgis.com/. You should be able to get some feedback there.

    Thanks,
    Timothy

  6. bwsparks says:

    I got a little screwed up with the NAME showing up wrong. I figured out that the name comes from the DISPLAY expression, not the LABEL expression.

  7. randall says:

    Cool stuff. But, I’m trying to convert a 3D polyline layer to KML and when I do the resultant elevations are converted from meters to feet. The problem is that the elevations were already in feet. I’ve tried to assign the Z coordinate system accordingly but have not had any success. Any ideas?

    Thanks,

    Randall McCoy