I've read a few questions\answers about converting a GeoJSON Shape into an ESRI Object.
Unfortunately, most of the answers pointed to decoding the dictionary's manually.
The problem:
The bug is that arcpy.asShape truncates all values to 3 decimal points and has been described at this site in arcpy.geometry __geo_interface__ and AsShape() function: loss of precision and holes. Naturally for most this is undesirable.
This is the solution i came up with:
from shapely.geometry import asShape
import arcpy
sr = arcpy.SpatialReference()
sr.factoryCode = 4326
sr.create()
arcpy.env.outputCoordinateSystem = sr
JSON = {'coordinates': [[[0.6049790000000712, 17.048294000000055],
[0.6068335000000502, 17.049157000000037],
[0.6067875000000527, 17.049668000000054]]],
'type': 'Polygon'}
jsonobj = asShape(JSON)
arcshape = arcpy.FromWKT(jsonobj.to_wkt(),sr)
print (arcshape.WKT)
>>>u'MULTIPOLYGON (((0.60497900000007121 17.048294000000055, 0.60683350000005021 17.049157000000037, 0.60678750000005266 17.049668000000054, 0.60497900000007121 17.048294000000055)))'
Environment:
- ArcGIS 10.1 SP1 for Desktop Quality Improvement Patch
- ArcGIS 10.1 SP1 for Desktop Background Geoprocessing (64-bit) Quality Improvement Patch