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'
Given empty geometries are actually/already supported by the geometry constructors, I think this idea should be merged with https://community.esri.com/ideas/10963 since what I am after is having the syntax for creating empty geometries be more intuitive and idiomatic.
This Idea has been closed as a duplicate of an idea found on the ArcGIS Pro Ideas Exchange.
If you would like to support this idea. Please comment and send your kudos to the idea linked below.
https://community.esri.com/t5/arcgis-pro-ideas/pythonic-arcpy-geometries/idi-p/940322
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.