import arcpy import time fc_workspace = "c:/test" fc_name = "test.shp" fc_fields = ( ("a", "TEXT", None, None, 50, "", "NULLABLE", "NON_REQUIRED"), ("b", "LONG", 8, None, None, "", "NULLABLE", "NON_REQUIRED"), ("c", "SHORT", 4, None, None, "", "NULLABLE", "NON_REQUIRED"), ("d", "DOUBLE", 11, 8, None, "", "NULLABLE", "NON_REQUIRED"), ("e", "FLOAT", 5, 2, None, "", "NULLABLE", "NON_REQUIRED"), ("f", "DATE", None, None, None, "", "NULLABLE", "NON_REQUIRED") ) arcpy.env.workspace = fc_workspace total_start = time.clock() start = time.clock() fc = arcpy.CreateFeatureclass_management(fc_workspace, fc_name, "POINT", spatial_reference="c:/Program Files/ArcGIS/Desktop10.0/Coordinate Systems/Geographic Coordinate Systems/World/WGS 1984.prj") end = time.clock() arcpy.AddMessage("Create Feature Class %.3f" % (end - start)) start = time.clock() for fc_field in fc_fields: arcpy.AddField_management(fc, *fc_field) end = time.clock() arcpy.AddMessage("Create Fields %.3f" % (end - start)) start = time.clock() arcpy.DeleteField_management(fc, "Id") end = time.clock() arcpy.AddMessage("Delete Id Field %.3f" % (end - start)) total_end = time.clock() arcpy.AddMessage("Total %.3f" % (total_end - total_start))
Create Feature Class 0.313 Create Fields 0.313 Delete Id Field 0.044 Total 0.670
Executing: testcreatefc Start Time: Mon Dec 13 19:42:04 2010 Running script testcreatefc... Create Feature Class 0.628 Create Fields 2.713 Delete Id Field 0.627 Total 3.968 Completed script testcreatefc... Succeeded at Mon Dec 13 19:42:09 2010 (Elapsed Time: 5.00 seconds)
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.