Support Empty Geometries with ArcPy Geometry Class Constructors

Idea created by bixb0012 Champion on Apr 21, 2015
    New
    Score30
    • Hornbydd
    • bixb0012
    • AltErica

    Constructing empty geometries isn't possible using the ArcPy Geometry classes. The only way to currently create an empty geometry in ArcPy is to use the arcpy.FromWKT as a geometry constructor. I propose the ArcPy Geometry classes support the construction of empty geometries.

    Currently, calling any of the ArcPy Geometry constructors with no arguments, a 'None' argument, or an empty arcpy.Array throws an exception.

    >>> arcpy.Polygon()
    Runtime error 
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\arcobjects\mixins.py", line 222, in __init__
        *gp_fixargs(args, True))
      File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\geoprocessing\_base.py", line 504, in <lambda>
        return lambda *args: val(*gp_fixargs(args, True))
    RuntimeError: Object: CreateObject cannot create geometry from inputs


    Instead, the constructors should generate an empty geometry of the appropriate type similar to geometry constructors from other Python (Shapely) and DBMS (SQL Server) packages.

    >>> pg = arcpy.Polygon()
    >>> pg.type
    u'polygon'
    >>> pg.WKT
    u'MULTIPOLYGON EMPTY'