Keyhole Markup Language (KML) is an XML-based file format used to represent geographic features in applications such as ArcGIS Earth and Google Earth. KML allows you to draw points, lines, and polygons on maps and globes and share them with others. Using KML you can also designate text, pictures, movies, or links to other GIS services that appear when the user clicks the feature. Many KML client applications are free and provide a familiar, user-friendly navigation experience.
What can you do with KML using ArcGIS Server
ArcGIS Server allows you to share your maps and data as KML in several ways:
- Map and image services expose a KML network link through Representational State Transfer (REST).
- You can create your own KML network link using Manager or the Services Directory.
- When you query map layers or perform a geoprocessing or geocoding operation through REST, you can get the results as KML.
In all these cases, the KML is dynamically generated, meaning that users who view the KML will always see the latest maps and data from your server. If you just want to generate static KML documents that you can e-mail or place on a file server, you can use the Map To KML and Layer To KML tools in ArcGIS Pro.
Configuring map and image services to return KML
To share your maps and imagery as dynamic KML, all you have to do is publish them as services using ArcGIS Pro. Both map services and image services can return KML. By default, the KML capability is enabled when you publish these services to your server.
Before you publish the services, you'll need to do some preparatory work. Map services require that you first prepare a map document containing the layers you want to make available as KML. In this map document, you can specify specific labeling, rendering, symbology, and HTML pop-up window properties that will be reflected in your KML. Three-dimensional properties need to be set in ArcGlobe and imported as layer files into your map document.
Image services require a raster dataset, mosaic dataset, or layer file referencing a raster dataset or mosaic dataset. You might prefer to use a layer file to define a specific renderer to ensure the image service looks the way you want it to.
KML through REST
All map and image services expose a KML network link through REST. Simply put, REST is a way of exposing information about your services through a series of navigable URLs. You can discover the URL to the network link using the Services Directory, which is an application designed to help you navigate the REST endpoints on your server. The URL points to a .kmz file that you can add to ArcGIS Earth or any other client that supports KML network links.
If you don't want to use the default network link, you can use Manager or the Services Directory to generate your own. See Viewing services as KML to learn more about REST, KML network links, and how ArcGIS Server works with both.
Viewing what's available on your server
Through the Services Directory, you can also view the footprints of all the map and image services on your server. Additionally, you can access a footprint KML network link that displays locations and descriptions of your services. You can use this footprint network link as a guide to show others what's available on your server.
Geocoding, geoprocessing, and query results as KML
Map services can return the results of geoprocessing, geocoding, and query operations as KML. These services can be used in client applications and can also be used directly by analysts typing in REST URLs. This is a good way to allow applications and users to selectively retrieve information from online geodatabases in KML format.
KML service operations
KML services have built-in operations that allow KML clients to perform various requests on the server. When publishing your maps and imagery, the SeparateImages, SingleImage, and Vectors operations are enabled by default.
- SeparateImages allows KML clients to make a request that will return a separate image, such as a KML ground overlay, for each layer in the service. For example, if you were viewing a KML service through a KML client, you could adjust the transparency of each layer in the service.
- SingleImage allows KML clients to request a single composite image as a KML ground overlay for all the layers in the service. This is similar to the export map image operation for map services.
- Vectors allows KML clients to make a request that will return individual features from all supported layers as their respective geometry type. This can include, points, lines, and polygons.
You can disable any one of these operations by accessing the Capabilities tab of ArcGIS Server Manager in.
Supported KML functionality
Below is a list of the functionality supported with KML services:
- Generation of KML 2.2-compliant KML
- Automatic availability of KML through REST
- Use of KML Regions to display cached map services via REST
- Availability of KML for image services
- Availability of service footprints as KML through REST
- Support for most ArcGIS Pro labeling capabilities
- Ability to turn labels off