I've run into an odd issue when using Arcpy to write multipart geometry to a shapefile. I am using an InsertCursor to create a multipart feature from a list of parts each with a list of vertex pairs. I understand that when this feature is created, adjacent multiple parts are automatically "dissolved" into a single part. But for some reason, this is creating an interior ring, even though I did not include a Null arcpy.point() in the array as is usually required to add interior rings. Here's a visualization:
Does anyone have any idea why this is happening and/or how to overcome the issue?
For reference, here's my code:
import arcpy
arcpy.CreateFeatureclass_management(r"C:\temp", "test.shp", "POLYGON")
OutputCursor = arcpy.InsertCursor(r"C:\temp\test.shp")
# List of parts, each with list of vertex pairs
ListOfParts = []
ListOfParts.append([[0,1],[1,1],[1,0],[0,0],[0,1]])
ListOfParts.append([[0,2],[1,2],[1,1],[0,1],[0,2]])
ListOfParts.append([[0,3],[1,3],[1,2],[0,2],[0,3]])
ListOfParts.append([[1,1],[2,1],[2,0],[1,0],[1,1]])
ListOfParts.append([[1,2],[2,2],[2,1],[1,1],[1,2]])
ListOfParts.append([[1,3],[2,3],[2,2],[1,2],[1,3]])
ListOfParts.append([[2,1],[3,1],[3,0],[2,0],[2,1]])
ListOfParts.append([[2,2],[3,2],[3,1],[2,1],[2,2]])
ListOfParts.append([[2,3],[3,3],[3,2],[2,2],[2,3]])
# Array of parts to be passed to newRow()
ArrayOfParts = arcpy.Array()
# Add parts to array
for Part in ListOfParts:
ArrayOfVertices = arcpy.Array()
for Vertex in Part:
ArrayOfVertices.add(arcpy.Point(Vertex[0],Vertex[1]))
ArrayOfParts.add(ArrayOfVertices)
ArrayOfVertices.removeAll()
# Output new feature
OutputFeature = OutputCursor.newRow()
OutputFeature.shape = ArrayOfParts
OutputCursor.insertRow(OutputFeature)