I want to create an empty geometry on one of my Polygons I have.
Anyone knoes how to do this with the Field Calculator in ArcGIS 10.2?
Solved! Go to Solution.
I am not even sure updating the Shape field is supported in the Field Calculator. I tried a few quick things and none of them worked.
In terms of ArcPy and cursors, the new ArcPy Data Access cursors do not support empty geometries. If you try to insert or update an empty geometry using those cursors, it will simply get converted to a NULL value in the Shape field of the table. Fortunately, the older/original cursors do support empty geometries. If you select the records in the layer you want to update, the following code in the interactive Python window will
replace their existing geometries with empty geometries (assuming you are working with polygons).
>>> cur = arcpy.UpdateCursor("layer") #replace "layer" with layer name to be updated. >>> for row in cur: ... row.setValue("SHAPE", arcpy.Polygon(arcpy.Array(None))) ... cur.updateRow(row) ... >>>
I am not even sure updating the Shape field is supported in the Field Calculator. I tried a few quick things and none of them worked.
In terms of ArcPy and cursors, the new ArcPy Data Access cursors do not support empty geometries. If you try to insert or update an empty geometry using those cursors, it will simply get converted to a NULL value in the Shape field of the table. Fortunately, the older/original cursors do support empty geometries. If you select the records in the layer you want to update, the following code in the interactive Python window will
replace their existing geometries with empty geometries (assuming you are working with polygons).
>>> cur = arcpy.UpdateCursor("layer") #replace "layer" with layer name to be updated. >>> for row in cur: ... row.setValue("SHAPE", arcpy.Polygon(arcpy.Array(None))) ... cur.updateRow(row) ... >>>