I wrote a simple script supposed to convert all layers in a mxd into kmz and it doesn't work. Kmz are being created but they're not what they should be.
import arcpy
arcpy.env.workspace = pathworkspace
mxd = arcpy.mapping.MapDocument(pathmxd)
allLayers = arcpy.mapping.ListLayers(mxd)
for layer in allLayers:
outputkmz = layer.name[:-4]+".kmz"
arcpy.LayerToKML_conversion(layer,outputkmz)
If i try to open myself in ArcMap the kmz created by the script, I get this error message.
Some points are being displayed but in a strange way, like if they were aligned while it's not the case. If I open them with Google Earth, it just doesn't display anything.
Other information: - I'm using I'm using ArcMap 10.5.
I'm using PythonWin
If I try the script with a .mxd where there's only one layer in the ToC, it's working. As soon as I add another layer, it doesn't work anymore.
If I try the conversion manually with the toolbox in ArcMap (convert layer to kml), it's working, so I guess it means the problem doesn't come from my .lyr files.
Doesn't seem to be a problem of coordinates system
This question is related to my other (more global) question here: Convert Shp to KMZ displaying labels using arcpy?