I'm looking for a way to convert all .lyr contained in a .mxd file into .kmz.
I wrote this script that is supposed to be simple but still, it doesn't seem to work.
The script is creating .kmz but these .kmz don't look like what they should. If I open them in ArcMap, I receive an error message saying "Warning, inconsistent extent". I can see some strange points though, but that seem aligned while they shouldn't be. If I open the kmz with Google Earth, it doesn't display anything, I just end up in the middle of the ocean...
arcpy.env.workspace = path
mxd = arcpy.mapping.MapDocument(path)
for layer in AllLayers:
outputkmz = layer.name[:-4]+".kmz"
- If the mxd contains only one layer in the ToC, it's working. As soon as there are more than 1, it's not working anymore
- I don't think it's a problem of Coordinates System
- I tried to play with the output extent in LayerToKML but didn't change much
- When I convert the .lyr manually in ArcMap with the toolbox, it's working, so the problem shouldn't come from the .lyr
- I noticed that when I convert manually, it's also creating a metadata file while it doesn't when I run the script. I don't know if that might help?
I feel like I tried everything and I really don't get why the script isn't working properly.