AnsweredAssumed Answered

best way to update feature layer via spatial data frame?

Question asked by joemcgl on Jul 23, 2018
Latest reply on Jul 23, 2018 by joemcgl

Hi, I am trying to update a hosted feature layer after some manipulation on the data as a data frame. I am trying to follow the presentation here: updating_features_in_a_feature_layer | ArcGIS for Developers 


As a test, I have `update_layer` as a Spatial Data Frame object, but it is essentially the result of `flayer.query().df`, so, I was hoping this would overwrite the data in the feature layer, with the data in the feature layer, thus not actually changing anything but testing the overwrite operation:



flayer = search_result[0].layers[0] # this is the feature layer I want to update

# get each row in the updated feature dataframe as a dictionary. store in a list.
features_for_update = [json.loads(row.to_json()) for index,row in update_layer.iterrows()]

# update should track by OID or whatever the default index is specified



However, I receive this error:

Cannot perform operation. Invalid operation parameters. 'updates' parameter is invalid Object reference not set to an instance of an object.

What is the correct representation of the items in `features_for_update`? The example in the link seems like it should be a list of dictionaries, which is what I have.