1

Using the ArcPy Layer To KML (Conversion) tool, how can I control the naming of the nesting in the KMZ structure?

My code gives me this:

enter image description here

I don't know why it chose the field that has the name "Oregon" (that field name is "state_name" in the SHP). I would like for it to use the "county_name" field.

How can I control the output so that it is like this:

enter image description here

## steps
# specify county (done in loop, simplified here)
# define selection criteria
# convert SHP to Layer for use in Select function
# select subset
# save to KMZ

c = 'Lincoln'
criteria = '"county_name" = {}'.format(c)
arcpy.MakeFeatureLayer_management(myfile.shp, 'myLayer')
subset = arcpy.SelectLayerByAttribute_management('myLayer', "NEW_SELECTION", criteria)
arcpy.LayerToKML_conversion(subset, 'myoutput.kmz')

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.