【发布时间】:2016-04-15 03:26:42
【问题描述】:
我是 Python 的新手。我正在尝试使用 arcpy.GetParameterAsText 函数将“源文件夹”和“地理数据库”作为 ArcGIS 工具箱中的输入参数。
我真的不确定将两个 arcpy.GetParameterAsText 函数放在哪里。我想将工作区设置为它吗?如果我这样做,我不知道如何在没有路径的情况下创建 GDB 文件。
# Set the workspace
arcpy.env.workspace = "C:\\Users\\x\\Desktop\\Python_Scripting\\4\\Lesson4_Data\\Lesson4_Data"
#Create the GDB
arcpy.CreateFileGDB_management("C:\\Users\\x\\Desktop\\Python_Scripting\\4\\Lesson4_Data\\Lesson4_Data","lesson4a.gdb")
# Set the feature class variables
fclist = arcpy.ListFeatureClasses("","polygon")
fctotal = arcpy.ListFeatureClasses()
# Start the loop on all feature classes
for fc in fclist:
fcdesc = arcpy.Describe(fc)
print fcdesc.basename + " is currently importing into the lesson4a.gdb."
arcpy.CopyFeatures_management (fc, "C:\\Users\\x\\Desktop\\Python_Scripting\\4\\Lesson4_Data\\Lesson4_Data\\lesson4a.gdb\\" + fcdesc.basename)
print fcdesc.basename + " is done importing into the lesson4a.gdb.\n"
【问题讨论】: