Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import arcpy
- # Determine range of FIDs (Shapefile) or ObjectIDs (GDB feature class)
- polyg = "PATH_TO_FEATURECLASSS"
- polygIDS = [x for x in arcpy.da.SearchCursor(polyg, ["OBJECTID"]]
- # Loop through rows, creating layer each time
- for i in polygIDs:
- whereclause = """{} = {}""".format(arcpy.AddFieldDelimiters (datasource, field), i)
- arcpy.MakeFeatureLayer_management(polyg,"polyg_lyr{}".format(i), whereclause)
- # Setup Output name / destination
- outKML = "PATHTOKML{}".format(i) #unique name by ObjectID
- # Output KML / KMZ file
- arcpy.LayerToKML_conversion("polyg_lyr{}".format(i), outKML)
- # Delete layer to free memory
- arcpy.Delete_management("polyg_lyr{}".format(i))
Add Comment
Please, Sign In to add comment