Hello,
I am trying to automate updates of a hosted feature service in Portal 10.8.1. I have a method to convert the feature class to a feature set, then pass the array of features from that feature set to the arcgis.features.FeatureLayer.edit_features(adds=[ftSet_array]). This function when run using a Portal feature service doesn't append any data. When I print the edit result, I see the following message:
@{'addResults': [{'objectId': None, 'success': False, 'error': {'code': 10500, 'description': 'class org.json.JSONObject cannot be cast to class com.esri.core.geometry.Geometry (org.json.JSONObject and com.esri.core.geometry.Geometry are in unnamed module of loader java.net.URLClassLoader @614ddd49)'}}], 'updateResults': [], 'deleteResults': [], 'attachments': {'addResults': [], 'updateResults': [], 'deleteResults': []}}
The exact same script/code works and appends the data as expected and incredibly fast/efficiently on a copy of the hosted feature service in ArcGIS Online.
In the snippet below, I converted a feature class to a feature set called add_features.
adds_array = []
for a in add_features:
adds_array.append(a)
total_adds = len(adds_array)
if total_adds > 10000:
print_to_stdout("Incrementally appending new data...")
n = 10000
inc_adds_array = [adds_array[i * n:(i + 1) * n] for i in range((len(adds_array) + n - 1) // n )]
for lst in inc_adds_array:
#print(lst)
edit_result = target_ftlyr.edit_features(adds=lst)
print("Edits summary: {0}".format(edit_result))
print("{0} total features successfully added to the feature service!".format(total_adds))
else:
edit_result = target_ftlyr.edit_features(adds=adds_array)
print({0} total features successfully added to the feature service!".format(str(len(adds_array))))
Is the FeatureLayer.edit_features() only available in ArcGIS Online?