Ich bin brandneu in Python. Ich versuche, den Quellordner und die Geodatabase als Eingabeparameter in einer ArcGIS-Toolbox unter Verwendung der arcpy.GetParameterAsText
-Funktion zu definieren.Wie stelle ich Eingabeparameter mit ArcGIS/Python her?
Ich bin wirklich nicht sicher, wo die beiden arcpy.GetParameterAsText
Funktionen zu setzen. Soll ich den Arbeitsbereich darauf einstellen? Wenn ich das tue, weiß ich nicht, wie man die GDB-Datei ohne den Pfad davor erstellt.
# 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"