AnsweredAssumed Answered

Failing to create polygon geometry via the Python API

Question asked by greg.stevenson on Jul 24, 2017
Latest reply on Apr 11, 2018 by simo

Hi guys, I'm trying to add a feature to AGOL via the Python API. My features are being created but with empty geometries. At the bottom is my geometry object that I am passing through. The geometry was created using the following so should be fine:

 

point = arcpy.Point(float(x),float(y))
sr = arcpy.SpatialReference(2193)
ptGeometry = arcpy.PointGeometry(point,sr)
buff_geometry = ptGeometry.buffer(length)
densify = buff_geometry.densify('DISTANCE',10,10)
shape = densify.JSON

 

I'm sure someone has pushed polygon objects through to AGOL via the Python API but I cannot find any code samples to compare mine too. Any help appreciated - also does the API handle true curves? Or do I need to use densify? Thanks! Greg.

 

{'geometry': '{"rings":[[[1795330.473,5541901.9229999995],[1795604.8544855313,5541877.9177305344],[1795870.8990284686,5541806.6313101035],[1796120.5229999998,5541690.2297405191],[1796346.1417020655,5541532.2498245714],[1796540.899824572,5541337.4917020649],[1796698.8797405194,5541111.8729999997],[1796815.2813101034,5540862.2490284685],[1796886.5677305341,5540596.204485531],[1796910.5729999996,5540321.8229999999],[1796886.5677305341,5540047.4415144688],[1796815.2813101034,5539781.3969715312],[1796698.8797405194,5539531.773],[1796540.899824572,5539306.1542979348],[1796346.1417020655,5539111.3961754283],[1796120.5229999998,5538953.4162594806],[1795870.8990284686,5538837.0146898963],[1795604.8544855313,5538765.7282694653],[1795330.473,5538741.7230000002],[1795056.0915144687,5538765.7282694653],[1794790.0469715314,5538837.0146898963],[1794540.4230000002,5538953.4162594806],[1794314.8042979345,5539111.3961754283],[1794120.046175428,5539306.1542979348],[1793962.0662594805,5539531.773],[1793845.6646898966,5539781.3969715312],[1793774.3782694659,5540047.4415144688],[1793750.3730000004,5540321.8229999999],[1793774.3782694659,5540596.204485531],[1793845.6646898966,5540862.2490284685],[1793962.0662594805,5541111.8729999997],[1794120.046175428,5541337.4917020649],[1794314.8042979345,5541532.2498245714],[1794540.4230000002,5541690.2297405191],[1794790.0469715314,5541806.6313101035],[1795056.0915144687,5541877.9177305344],[1795330.473,5541901.9229999995]]],"spatialReference":{"wkid":2193,"latestWkid":2193}}'

Outcomes