You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 31, 2020. It is now read-only.
I can update features from the updateFeatures REST page with the following:
/* This is a valid updateFeatures parameter */[{"attributes" : {"OBJECTID": 3325,"Name" : null}},{"attributes" : {"OBJECTID": 152504,"Name" : "Joe Smith"}}]
ArcREST's layer function to updateFeatures only appears to update from fully built feature objects. No error is thrown when the features parameter only contains attributes. updateFeatures succeeds but only returns {'updateResults': []} instead of {'updateResults': [{'objectId': 3325, 'globalId': None, 'success': True}, {'objectId': 152504, 'globalId': None, 'success': True}]}
Here is my workaround, but it would be nice to allow attribute updates from the function:
"""dict1 - is a dictionary of hosted features. Values have been changed to match a different data source.list_CustomerIDs - is a list. It lists the dict1 keys which are used to update specific featuresattributes - is a list of dicts of individual feature attribute updates"""attributes= [{"attributes":{"OBJECTID":dict1[key][4],"Name":dict1[key][0],"CustomerID":dict1[key][1],"Address":dict1[key][3]}} forkeyinlist_CustomerIDs]
# setup initial params dictparams= {"f" : "json", "rollbackOnFailure" : True}
result=None# There should be a check here to make sure the attributes has at least the feature layer OID or GlobalIDiflen(attributes) >0:
#add features key:values# using json dumps here change syntax from python to json (None to null, escape special characters, etc...)params['features'] =json.dumps(attributes)
params['token'] =fl._tokenuurl=fl.url+"/updateFeatures"result=fl._do_post(url=uurl, param_dict=params, proxy_port=fl._proxy_port, proxy_url=fl._proxy_url)
printresult# {'updateResults': [{'objectId': 152504, 'globalId': None, 'success': True}, {'objectId': 3325, 'globalId': None, 'success': True}]}
It would be nice to just call:
fl.updateFeatures(attributes)
My code above is a little too workflow specific, but updateFeatures could take a list of dicts of field:attribute like:
attributeUpdates= [{"OBJECTID":3325,"Name":None},{"OBJECTID":152504,"Name":"Jeff's Grocery Store"}]
#build features param for postparams['features'] =[{"attributes":{fields:valuesforfields,valuesinrow.iteritems()} forfields,valuesinrow.iteritems()} forrowinattributeUpdates]
#Results in [{'attributes': {'Name': None, 'OBJECTID': 3325}}, {'attributes': {'Name': "Jeff's Grocery Store", 'OBJECTID': 152504}}]
Hope this is useful
The text was updated successfully, but these errors were encountered:
Thank you for the suggestion. We will consider it for the next major release, but at this time, we will not add this feature. I am going to go ahead and close this issue.
I can update features from the updateFeatures REST page with the following:
ArcREST's layer function to updateFeatures only appears to update from fully built feature objects. No error is thrown when the features parameter only contains attributes. updateFeatures succeeds but only returns {'updateResults': []} instead of {'updateResults': [{'objectId': 3325, 'globalId': None, 'success': True}, {'objectId': 152504, 'globalId': None, 'success': True}]}
Here is my workaround, but it would be nice to allow attribute updates from the function:
It would be nice to just call:
My code above is a little too workflow specific, but updateFeatures could take a list of dicts of field:attribute like:
Hope this is useful
The text was updated successfully, but these errors were encountered: