LayerToKML_conversion won't convert entire layer

414
3
Jump to solution
01-18-2019 11:02 AM
AliceElliott
New Contributor II

I'm trying to convert a vector layer to a KML file.

Here's what the layer looks like in ArcMap-- as you can see, it has multiple polygons:

enter image description here

Here's my code:

import arcpy
arcpy.env.workspace = r'C:\\username\\folder'
mxd = arcpy.mapping.MapDocument(r"PreHex272.mxd")
lyr = arcpy.mapping.ListLayers(mxd)[0]
arcpy.LayerToKML_conversion(lyr, "kml_tests.kmz")

But it only outputs one small polygon in Google Earth:

enter image description here

I do not have any polygons selected. In fact, I tried selecting a different polygon and got the same result. I tried selecting all polygons and got the same result. I also tried restarting Google Earth, with no luck.

I'm using ArcGIS Desktop 10.6.1 on Windows 7.

Thanks in advance!

(Hopefully this is the right place to post-- I'm still getting used to picking which GeoNet "community" to post in. Sorry if this is not the correct location.)

0 Kudos
1 Solution

Accepted Solutions
AliceElliott
New Contributor II

Thanks for the response. Turning off the terrain didn't help-- I think the reason for the spotty line that you mentioned is just because I had a weird Google Earth symbology ("filled + outlined"). Also, the Clamped To Ground option was already enabled.

But stopping editing and restarting my MXD file fixed the problem. (Just stopping editing didn't fix it-- I had to completely shut down all Arc-related processes and re-run the script when I reopened the file.)

Hopefully this helps anyone who is also having this problem!

View solution in original post

3 Replies
JimCousins
MVP Regular Contributor

It looks like you have terrain turned on in google earth, and your data is only above the ground surface where you can see it. Even that line is spotty as it cuts through the ground surface. Try turning off GE terrain, or look into "Clamped Features to ground" option during conversion of the layer to KML.

Regards,

Jim

AliceElliott
New Contributor II

Thanks for the response. Turning off the terrain didn't help-- I think the reason for the spotty line that you mentioned is just because I had a weird Google Earth symbology ("filled + outlined"). Also, the Clamped To Ground option was already enabled.

But stopping editing and restarting my MXD file fixed the problem. (Just stopping editing didn't fix it-- I had to completely shut down all Arc-related processes and re-run the script when I reopened the file.)

Hopefully this helps anyone who is also having this problem!

DannyMcVey
Esri Contributor

Does the resulting KMZ file display correctly in ArcMap?

0 Kudos