2

ArcGIS Server allows the user to apply edits in an editable layer.

Eg the sample layer at http://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/FeatureServer/3/applyEdits will accept a JSON input response such as [{'attributes': {'distance':1234}}]

Assuming that I have a JSON object in Python, how can I send this object to ArcGIS Server? ie, what is the Python syntax for Apply Edits?

I presume it's something along the lines of urllib2.urlopen(<endpoint>, <JSON>) but I can't figure out the exact syntax.

asked Mar 2, 2014 at 21:37

1 Answer 1

2

This syntax seems to work:

packet = {'attributes': {'distance': 12345}}
data = urllib.urlencode({'features': packet, 'f': 'pjson', 'rollbackOnFailure': True})
response = urllib2.urlopen(endPoint, data).read()

The result is:

[Dbg]>>> print(response)
{
 "addResults" : [
 {
 "objectId" : 12, 
 "globalId" : null, 
 "success" : true
 }
 ]
}
answered Mar 3, 2014 at 0:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.