An ArcMap MXD map document can be published as an ArcGIS Server GIS Service to serve KML dynamically over the web. After publishing the ArcMap document with KML capabilities enabled, a client can connect to the GIS Service and request KML data for a specific geographic area using a properly configured URL to the GIS Service or by connecting to a KML network link document that embeds a properly configured URL to the GIS Service. This tutorial walks you through the process of creating and configuring a KML service.
If the ArcMap document contains feature classes with 2D geometries it is a simple matter, described below, to publish a KML GIS Service. However, to publish feature classes with 3D attributes such as z-offsets or extrusion based on attributes, you must first edit the feature class layer properties in ArcGlobe and save them as a layer file, then add the layer file to an ArcMap document. For example, if you have a polygon feature class with a population density attribute, you can set the extrusion properties for that class in ArcGlobe, save the feature class as a layer file, then, add the layer file to an ArcMap document.
Open ArcGlobe and add a feature class.
Open the layer properties by right-clicking on the layer name and choosing "Properties...".
Click the "Globe Extrusion" tab in the Layer Properties panel.
Select "Extrude features in layer" and "Do not draw bottom face of extruded polygons".
Set an Extrusion value or expression. In this case, the polygon features are extruded by the value of the "POP_DENSITY" attribute multiplied by 100 then adding this value to the feature base height.
Now that the extrusion is set for the layer, right-click the layer and select "Save As Layer File" from the context menu.
Now that 3D properties have been determined for the data, it's time to open ArcMap and set the 2D layer properties.
In ArcMap, add the layer just saved from ArcGlobe.
Set the 2D layer properties by right-clicking the layer and selecting "Properties" from the context menu.
Choose the "General" tab and edit the scale-dependency of the layer and enter a description. This description will be used for the KML layer description displayed in KML clients and can contain any valid HTML.
Choose the "Display" tab and alter the transparency of the layer if you wish.
Choose the "Symbology" tab and change the rendering properties.
Choose the "Fields" tab and alter the Primary Display Field if you wish. This value of this field will be used to label the features in the table of contents. You can also use two reserved aliases, KMLDescription and KMLSnippet, in any two fields in the feature class. The values of the field that you change to use the KMLDescription alias will be displayed when a user clicks on a feature in the table of contents of a KML client. The values of the KMLDescription alias field can contain any valid HTML. The values of the field that you change to use the KMLSnippet alias will be displayed below each feature's icon in the table of contents of a KML client. The values of the KMLSnippet alias field can also contain any valid HTML.
Once the 2D and 3D properties of an ArcMap document have been set, you need to follow only a few simple publishing steps to create a KML service. Follow the same procedure used to create an ArcGIS Server map service, but additionally, select the "KML" capability. The steps below show how to do this in ArcCatalog. If you want to use Manager to create the service, follow the corresponding steps in Publishing a GIS resource to the server.
Using ArcCatalog, find the ArcMap Document you wish to publish in the file system.
Right-click on the ArcMap Document and select "Publish to ArcGIS Server" from the context-menu.
Choose an existing folder (or create a new one) in which to publish your KML-capable GIS Service.
In the second "Publish to ArcGIS Server" Panel, choose the KML capability for your GIS Service and click "Next'.
Review the summary of what will be created in the third "Publish to ArcGIS Server" panel and click "Publish".
Your service has now been published and can be previewed in ArcCatalog by expanding the GIS Servers node and the folder in which you published your service, then selecting your service and the "Preview" tab in the adjacent panel.
After publishing the KML service, you may want to edit its default properties. To do this, follow the steps below:
First stop the service in ArcCatalog, by right clicking on the service name and selecting "Stop" from the context-menu.
Next, right click on the service name and select "Service Properties" from the context-menu.
Select the "Capability" tab in the "ArcGIS Server – Map Service Properties" panel.
Check the "KML" box and edit the Properties in the lower panel.
Restart the service by right-clicking on the service name and choosing "Start" from the context-menu.