I tried to run this script for converting a batch of shp files in a folder... But i receive error msg posted below... Kindly suggest...
# Set environment settings
arcpy.env.workspace = r"D:\Work\Test"
outKML = r"D:\Work\Test\new"
# Variables Defined
composite = 'NO_COMPOSITE'
pixels = 2048
dpi = 96
clamped = 'CLAMPED_TO_GROUND'
scale = 10000
for layer in arcpy.ListFiles():
arcpy.LayerToKML_conversion(Flayer, outKML,scale, composite,
'', pixels, dpi, clamped)
arcpy.AddMessage('There are no layer files in '+arcpy.env.workspace+'.')
Traceback (most recent call last):
File "D:\Work\Test\Test.py", line 13, in <module>
NameError: name 'Flayer' is not defined
May I suggest that you use python syntax highlighting (in the advanced editor) to post code.
But, your problem seems obvious. Where are you defining what the variable Flayer is.
Or do you want to call the output feature layer "Flayer".
You should use ListFeatureClasses rather than ListFiles, because ListFiles will return all individual files from a shapefile (e.g. shp, and shx, and dbf, etc.).
Also, as your code is now, you will overwrite your output KML over and over because you don't change the name on each iteration.