import arcpy arcpy.env.workspace = r'C:\Project\999999\myFGDB.gdb' # example FileGeodatabase as workspace arcpy.env.workspace = r'C:\Project\999999\mySHPfolder' # example folder (with shapefiles) as workspace fclasses = arcpy.ListFeatureClasses() for fclass in fclasses: fctype = arcpy.Describe(fclass).shapeType print "{0} is a {1} feature class".format(fclass, fctype)
import arcpy, os arcpy.env.workspace = r'C:\Project\999999\mySHPfolder' fclasses = arcpy.ListFeatureClasses() out_ws_all = r'C:\Project\999999\test_all.gdb' out_ws_pol = r'C:\Project\999999\test_pol.gdb' for fclass in fclasses: fctype = arcpy.Describe(fclass).shapeType newname = fclass if newname[-4:].upper() == ".SHP": newname = newname[:-4] # trim the .shp extension from the name out_fc = os.path.join(out_ws_all, fclass) arcpy.CopyFeatures_management(fclass, out_fc) if fctype == 'Polygon': out_fc = os.path.join(out_ws_pol, fclass) arcpy.CopyFeatures_management(fclass, out_fc)
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.