Issue with geometry not being created with /addFeatures

1030
3
06-19-2018 12:26 AM
AnthonyCheesman1
Occasional Contributor II

Hi

I'm a ArcGIS REST API learner driver at the moment, so please be gentle!

Using the REST API, I'm attempting to create features in a feature service using the /addFeatures option. The POST request is being made via Python, using the requests library.

The code I am using is executing successfully, and I am getting a Success = True response from the call, but the geometry is not being created in the feature service - rather, a record is being created with the correct attributes, but null geometry.

An example of the payload being sent to the feature service is below:

{'geometry': u'{"rings":[[[2821343.5468000025,2494844.3574000001],[2822216.6736000031,2489208.7210999988],[2822216.6736000031,2489169.0335000008],[2814914.1589000002,2489314.5546999983],[2814821.5546000004,2494831.1281999983],[2821343.5468000025,2494844.3574000001]]],"spatialReference":{"wkid":102171,"latestWkid":3111}}', 'attributes': {'GLOBALID_TEXT': '{4986E78C-60AD-44DD-A36F-58E5B8630948}', 'FIRE_OBS_TYPE_PY': u'CurrBurntArea', 'INCIDENT_NAME': u'21 WALKER ST', 'OBS_CREATEDATE': 1504788222000L}}

The success message being returned is:

{"addResults":[{"objectId":1457,"globalId":"5DB01C2C-FEBE-4E31-B714-8D10744C2517","success":true}]}

The JSON geometry object being used in the payload is being sourced from an fGDB feature class, using a SearchCursor and the 'SHAPE@JSON' field name. 

Having checked some of the help documentation, I note that the geometry JSON doesn't explicitly reference hasM or hasZ, which is included in the docs, but given that the success message gets returned I am unsure if this is the issue.

Can anyone with a better understanding of REST and JSON than me tell me why I am having the issue I am?

Many thanks!

Ant

Tags (3)
3 Replies
BryanMc
Occasional Contributor

Not sure if related but a few things you could try...

Noticed the input JSON has a mix of single quotes and double quotes. Technically JSON doesn't support single quotes (at this version of JSON spec) - try changing all to double quotes.

As well, the spatial reference specification has both a wkid and latestWkid. Not sure if both are supported during addFeatures. Possibly try with just wkid.

0 Kudos
JENNIFERHIGGS
New Contributor III

We are having a similar issue.  A few times week, features appear to be created.  We get a Success response, we can query the object and see the geometry, but a little while later the feature is not really added to the geodatabase.   We are not even getting a null geometry.  Have you found a solution to this problem?

0 Kudos
MohamadMousheimish1
New Contributor II

Anyone found a solution for this?

0 Kudos