When calling FeatureSet.from_geojson (ArcGIS API for Python) in an ArcGIS Pro 2.6 python command line or an advanced Juypter Notebook in ArcGIS Online, I sometimes receive the following error:
TypeError: the JSON object must be str, bytes or bytearray, not 'Polygon'
The problem for me occurs when my geojson encodes a complex doughnut polygon and the ArcGIS API for Python appears to be attempting to utilise arcpy.
The error seems to originate in the following python module in both ArcGIS Pro and AGOL:
lib/site-packages/arcgis/features/feature.py
More specifically, around lines 880 and 907 in the feature.py module I've noticed the following code:
geom = arcpy.AsShape(geom)
geometry = Geometry(json.loads(geom))
I think here that geom is a geometry object, and this is causing json.load to crash.
I'm guessing that what is intended here is that Geometry is expecting to be passed a geometry object, so maybe the code could be corrected as follows (not sure):
geom = arcpy.AsShape(geom)
geometry = Geometry(geom)
I'm just wondering if this issue (if it is an issue) has been reported before? And if so is there a fix forthcoming, or a work-a-round?