Implement __geo_interface__ in ArcGIS Python API

Idea created by bixb0012 Champion on Jan 5, 2017
    Under Consideration
    Score40
    • aewilson
    • bixb0012
    • Dan_Patterson
    • xander_bakker

    I suggest adding __geo_interface__ support to arcgis.features and arcgis.geometry.

    __geo_interface__ is "a GeoJSON-like protocol for geo-spatial (GIS) vector data."  It follows a similar model/idea as NumPy's Array Interface.  It was proposed or put forward in 2013, and more than a dozen geospatial Python applications (see Python Geo_interface applications) implement the protocol.  The protocol allows for simple and efficient transferring of features and geometries between various geospatial Python packages.

     

    ArcPy currently supports __geo_interface__ in its Geometry classes (it can be argued there is only partial support since the current implementation is broken in several ways).    On a system with both ArcPy and Shapely installed, passing a geometry object from the former to the latter can be done efficiently with a single function call:

    >>> import arcpy
    >>> from shapely.geometry import shape
    >>>
    >>> arc_polygon = arcpy.FromWKT('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))',
    ...                             arcpy.SpatialReference(3857))
    ...
    >>> arc_polygon.area
    100.0
    >>>
    >>> shapely_polygon = shape(arc_polygon)  # pass ArcPy geometry to Shapely
    >>>
    >>> shapely_polygon.area
    100.0
    >>> shapely_polygon.buffer(1.0).area
    143.13654849054595
    >>>


    Granted, there are numerous ways features and geometry objects can be passed between geospatial Python packages, but __geo_interface__ represents an established, open, well-adopted, and efficient means that should be supported within the ArcGIS Python API.  Additionally, the protocol is lightweight and straightforward to implement.