Select to view content in your preferred language

Kml to Layer in Script Gives No Result

11-11-2019 04:14 PM
New Contributor


I am trying to build a tool that converts a layer to a kmz at the end. I tested the following code in my IDE and it works fine. But once I add the exact same lines as a script to ArcPro and run it from there it produces nothing. I have tried this on different layers (group/single) and all with the same result so I don't think it's specific to my layer. 

I'm wondering why this happens. Workarounds are fine too as long as I can get the script to run in ArcPro. 

KmzOutput= r"C:\Users\tracy\OneDrive\Documents\Python Scripts\Sample.kmz"
LayerFile= r"E:\\GIS_DoNotSynch\\ArcpyToolFiles\\Scratch\\Sample.lyrx"

Thank you!

Tags (2)
0 Kudos
1 Reply
Esri Contributor

Hi Tracy, 

My name is Adam I work in Esri support, Thank you for the post, we are investigating this tools on support case. 

Did you try a layer instead of a layer file? 

import arcpy

in_feature = r'C:\GIS\My_Data.shp'
out_kml = r'C:\GIS\my_KMZ_test.kmz'

arcpy.MakeFeatureLayer_management(in_feature, "Map_Layer")
arcpy.LayerToKML_conversion("Map_Layer", out_kml) 

Let me know if this works or not, 


Esri Support Services.

0 Kudos