I have a mxd file with more than 800 layers, and I want to convert all of these layers to KML files. I have tried to use the batch option in the "Layer to KML" tool, but I have to set there every layer manually, which is crazy. Is there any way to auto-fill all of the layers in my mxd file into the batch table? There is any other way to convert multiple layers into a KML files? (One KML file for each layer).

  • Have you tried multiple selecting then dragging and dropping from the TOC into the batch grid? – PolyGeo Oct 13 '16 at 11:29
  • Are you open to use a python script? – Below the Radar Oct 13 '16 at 11:46

You may use Map to KML (converts many layers in mxd to kmz):

This tool converts a map document into a KML file containing a translation of Esri geometries and symbology. This file is compressed using ZIP compression, will have a .kmz extension, and can be read by any KML client including ArcGIS Explorer, ArcGlobe, and Google Earth.


Use a python script. Scripts can be executed in the Python window in ArcMap. Code below will run Layer to KML for all layers in the MXD. For each layer a kmz file will be generated. If you want to specify any optionals parameters you can do so, see Layer To KML for help.

import arcpy
arcpy.env.workspace = r'C:\Temp\KML' #Change path to where you want to store the KMZ files
mxd = arcpy.mapping.MapDocument(r'C:\Temp\Untitled.mxd') #Change to Point to your MXD

for lyr in  [x for x in arcpy.mapping.ListLayers(mxd) if x.isFeatureLayer]:
    arcpy.LayerToKML_conversion(layer=lyr, out_kmz_file=lyr.name+'.kmz')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.