Polygons are also inserted, or updated, using cursors. The ArcPy Polygon Geometry type does not require the coordinate pairs to include the first point twice (that is, as the first point and as the last point). The polygon is closed automatically by the arcpy.Polygon()
function:
listOfPoints = [(6002672.58675, 2092447.04362), (6003672.58675, 2093447.04362), (6004672.58675, 2093447.04362), (6004672.58675, 2091447.04362) ] polyName = 'New Polygon' polyID = 54321 blockPoly = r'C:\Projects\PacktDB.gdb\Chapter5Results\TestPolygon' insertCursor = arcpy.da.InsertCursor(blockPoly, ['SHAPE@', 'BLOCK', 'BLOCKID']) polyArray = arcpy.Array() for pointsPair in listOfPoints: newPoint = arcpy.Point(*pointsPair) polyArray.add(newPoint) newPoly = arcpy.Polygon(polyArray) insertData = newPoly, polyName, polyID insertCursor.insertRow(insertData)
Here is a visualization of the result of the insert operation: