1, a phenomenon explained
Arcpy.da.searchcursor obtained using Geometry, Geometry converted into Array, then converted back from Array Geometry. If Geometry contains an inner ring, a process that could lead to the loss of the inner ring, and irreversible.
For example, the original pattern as shown below:
Use the following code:
import arcpy arcpy.env.workspace = "C:\\scripts\\test8.gdb" arcpy.env.overwriteOutput = True fc1 = "feature_with_hole" fc2 = "target_feature" arcpy.CreateFeatureclass_management(arcpy.env.workspace, fc2, "POLYGON", fc1, "DISABLED", "DISABLED", fc1) c1 = arcpy.da.SearchCursor(fc1, ["SHAPE@"], "OBJECTID = 1") for row in c1: geo1 = row[0] array = geo1.getPart(0) c2 = arcpy.da.InsertCursor(fc2, ["SHAPE@"]) geo2 = arcpy.Geometry('polygon', array) c2.insertRow([geo2])
After two conversions, to give the following pattern:
2, Analysis
After analysis, the conversion from the Array Geometry over, between one of the inner and outer rings of Item None, by inserting the following code fragment demonstrated:
Print results are as follows:
Whereas when converting back from Geometry Array, None Item Item and thereafter will be ignored, as evidenced by the following code fragment inserted:
Print results are as follows:
3, how to avoid?
When converted back from Geometry Array, will None Item removed to the inner part of the full restore. Demonstrated by inserting the following code fragment:
Print results are as follows:
4, summary
1) converted from Geometry over Array, is performed through a gap between the inner and outer rings None of the Item;
2) Array converted back Geometry, None Item and Item after will be ignored;
3)Array转换回Geometry时,将None Item去掉,即可将内环部分完整还原。