Skip To Content
ArcGIS Developers
Dashboard

KML output and operations

KML is supported as an output format when using the REST API in the following ways:

  • Map and image service footprints
  • Fused raster representation for map and image services
  • KML regions and dynamic ground overlays
  • Query results
  • Geocode results
  • Geoprocessing task results
  • Custom raster or vector compositions corresponding to selected layers from a map service

KML options are not available when services are secured using token-based authentication. The following options are available for requesting data in KML format.

KMZ format

The KMZ format (f=kmz) is an accepted response value for the format (f) parameter that can be passed in requests. The response is a KML document wrapped in a KMZ file. It may be a footprint or the result of an operation. For more information about format output options, see Output formats.

In the following example, a request is made for a KML footprint of a map service of Naperville shelters:

https://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/MapServer?f=kmz

KML region or ground overlay documents

This option is used when requesting a KML region or ground overlay wrapped in a KMZ file. In comparison with the KMZ format (f=kmz), this option is used when you click the View In ArcGIS Earth link when in the Services Directory. For more information about KML region or ground overlay documents, see KML Image for map services and image services.

In the following example, a request for a map service is returned as a KML region:

https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/kml/mapImage.kmz

The next example shows a URL to an image service, which is always returned as ground overlay KML:

https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/CaliforniaDEM/ImageServer/kml/image.kmz

Generate KML operation

You can use the Generate KML operation if you want to generate a KMZ document that contains a network link to the KML service endpoint with properties and parameters you specify. When using Services Directory, you navigate to the page of the map service you want to view. From the Map Operations list, click the Generate KML link. A server administrator can limit or disable some options. For example, the administrator may have disabled the ability for the server to return vector features, or the administrator may have a set limit on how many KML features the server can return. For more information, see the Generate KML operation.

In this topic