layers = get_layers() bigArea = 0 bigAreaPIN = None with arcpy.da.SearchCursor(layers['parcels_fc'], ["Shape_Area", "PIN10"]) as rows: for row in rows: if row[0] > bigArea: bigArea = row[0] bigAreaPIN = row[1] else: pass del rows print bigArea, bigAreaPIN arcpy.Dissolve_management(layers['parcels_fc'], "in_memory") with arcpy.da.SearchCursor("in_memory", ["SHAPE@"]) as rows: for row in rows: newPolygon = row[0] del rows subparcels = [] with arcpy.da.UpdateCursor(layers['parcels_fc'], ["PIN10", "SHAPE@"]) as rows: for row in rows: if row[0] == bigAreaPIN: row[1] = newPolygon rows.updateRow(row) else: subparcels.append(row[0]) rows.deleteRow() del rows with arcpy.da.InsertCursor(layers['superparcel'], ["original", "superparcel"]) as insert: for x in subparcels: insert.insertRow((x,bigAreaPIN)) del insert arcpy.RefreshActiveView() arcpy.Delete_management("in_memory")
Solved! Go to Solution.
arcpy.env.overwriteOutput = True works correctly when using the add-in, not with copy-and-pasting into the Python window.
Thanks all for your help.