I am looking for a method to upload and replace multiple layers in ArcGIS Online that are stored within a (hosted) feature layer. I have the feature classes to be used to update (and identical in name) stored in a fgdb on my local drive.

Does anyone have any ideas or tips to a script that are able to perform what I am looking for? I am fairly new to scripting, and have not been able to find other suggestions that updates multiple layers in a feature layer and deletes the old ones.

  • I believe the right way is to truncate the hosted feature layer and then append your data. This link shows a variaton for AGOL: community.esri.com/docs/…
    – user90323
    Commented Sep 10, 2020 at 10:11
  • Thank you @carlos, but isn't that script for updating one feature class only? Or am I missing something?
    – Sineik
    Commented Sep 10, 2020 at 10:22
  • That is true. It truncates the first layer of the hosted feature layer (see: fLyr = premiseLayer.layers[0] in Line 55). You would need to adjust the script to truncate the right layer and then append with the correct one from your gdb. Maybe you can truncate the whole hosted feature layer by removing the [0].
    – user90323
    Commented Sep 10, 2020 at 10:47


Your Answer

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