Create Empty Geometry ArcGIS 10.2

4478
1
Jump to solution
11-23-2015 08:21 AM
PV
by
New Contributor III

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?

0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

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)
...     
>>>

View solution in original post

1 Reply
JoshuaBixby
MVP Esteemed Contributor

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)
...     
>>>