dmarkey

Iterating Create KML Script

Discussion created by dmarkey on Nov 10, 2011
Latest reply on Nov 16, 2011 by dmarkey
Hi.

I am attempting to convert a number of layer files to KML/KMZ. The script below is what I have so far. The output component is where the error occurs, something about an invalid file type.

# Import system modules
import arcpy
from arcpy import env

# Obtain a license for the 3D Analyst extension
arcpy.CheckOutExtension("3D")

# Set environment settings
env.workspace = "C:\\data"
Location = "C:\\data\\"


for layer in arcpy.ListFiles("*.lyr"):
    arcpy.LayerToKML_conversion(layer, Location + kmz, "10000", "false", "Default", "1024", "96")

Outcomes