Guest User

Untitled

a guest
Oct 22nd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import arcpy
  2. # Determine range of FIDs (Shapefile) or ObjectIDs (GDB feature class)
  3. polyg = "PATH_TO_FEATURECLASSS"
  4. polygIDS = [x for x in arcpy.da.SearchCursor(polyg, ["OBJECTID"]]
  5. # Loop through rows, creating layer each time
  6. for i in polygIDs:
  7. whereclause = """{} = {}""".format(arcpy.AddFieldDelimiters (datasource, field), i)
  8. arcpy.MakeFeatureLayer_management(polyg,"polyg_lyr{}".format(i), whereclause)
  9. # Setup Output name / destination
  10. outKML = "PATHTOKML{}".format(i) #unique name by ObjectID
  11. # Output KML / KMZ file
  12. arcpy.LayerToKML_conversion("polyg_lyr{}".format(i), outKML)
  13. # Delete layer to free memory
  14. arcpy.Delete_management("polyg_lyr{}".format(i))
Add Comment
Please, Sign In to add comment