import arcpy from arcpy import env env.overwriteOutput = True env.workspace = r"C:\MapsandGeodatabase\LocalGovernment.gdb" arcpy.CreateTable_management(env.workspace, "AREA_SUM") arcpy.AddField_management("AREA_SUM", "Name", "Text", "75") arcpy.AddField_management("AREA_SUM", "SUM_Shape_Area", "Double") for dataset in arcpy.ListDatasets("*"): lstFCs = arcpy.ListFeatureClasses("*", "", dataset) for fc in lstFCs: desc = arcpy.Describe(fc) if desc.shapeType == "Polygon": rows = arcpy.InsertCursor("AREA_SUM") row = rows.newRow() row.Name = fc sumArea = arcpy.Statistics_analysis(fc, "Stats", [["Shape_Area", "SUM"]]) rows2 = arcpy.SearchCursor(sumArea) for row2 in rows2: totArea = row2.getValue("SUM_Shape_Area") row.SUM_Shape_Area = totArea rows.insertRow(row) totArea = 0 del row, rows, row2, rows2 arcpy.Delete_management("Stats")
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.