Hi Jordan Miller,
With sync-enabled Hosted Feature Layers in ArcGIS Online, editors can sync offline edits at any time. Ideally this would be with a strong WiFi connection.
Do you mean update the Hosted Feature Layer as in append new features or overwrite from a desktop client?
Yes, update a Hosted Feature Layer with sync enabled.
It is not possible to overwrite a Feature Hosted Layer with sync enabled:
I've investigated this script - but can't get it to work for me.
Scenario: Maps made for Collector usually have reference layers, such as, road network. These layers need to go offline (sync enabled) and need to updated on occasions.
From what I've read, the only way to update layers with sync enabled is to append.
I'm currently looking at using the geoprocessing functions: delete rows & append to update these layer.
But, as Jordan Miller asks, it would be good to know what is Esri's recommended method.
As far as the best path forward, I think you have two options.
These depend on the end goal of the data changes. Both of these operations can be scripted.
With a sync-enabled layer, as you mentioned you can add features via append. Updating features through append is not possible with sync enabled layers. Append would be the best option if you want to add thousands of features to the service. Deleting rows and appending to the hosted feature layer works as well. Append documentation: https://doc.arcgis.com/en/arcgis-online/manage-data/manage-hosted-feature-layers.htm#APPEND
If the data updates are smaller and contain adds, updates and deletes, using a scripted applyEdits request is the best option. I did some quick testing to confirm, and all three operations are allowed with offline replicas present. My offline replicas with edits synced without issue too. Here is our developer documentation on this: https://developers.arcgis.com/rest/services-reference/apply-edits-feature-service-.htm
I hope this helps,
Hi Peter Klingman,
From our enterprise gdb, we've published a hosted feature layer on AGO, with sync enabled. The purpose of the AGO layer is 1) for use in a variety of web maps and applications and 2) to take offline as a reference layer in Collector or Field Maps.
The feature class in our enterprise gdb contains about 700 features, and undergoes a small number of edits on a weekly basis including adding features, editing attributes or occasionally deleting a feature. I need to be able to update the AGO layer to reflect changes. I cannot use overwrite because sync is enabled (and users have a few offline areas downloaded to their devices).
I'd like to have a script push the on premise edit to the AGO FL, and schedule it to run nightly. The workflow I'm describing seem similar to Nick Shannon's use case. For my scenario, is it your recommendation that we use Py API to identify the set of features that have been edited via add, update or delete and then use Apply Edits to push the edits to AGO? Would you have an example script to share?
Or is there a better way? We have several key datasets for which I'll need to implement a best practice solution. Thanks.
Hi Katie Andrews,
With a small number of edits, I think a script that uses the ArcGIS API for Python's Edit_features function (example here) could be a good choice. I think what could be challenging here is linking the changes made in the Enterprise GDB to the features in the Hosted Feature Layer that need to be updated/deleted.
If you have ArcGIS Enterprise, Distributed Collaboration would be good to look into for this scenario.
Per my recommendation above and the direction Nick was investigating, you may also want to look into using the Delete Features—ArcGIS REST API | ArcGIS for Developers Rest API function to delete all your features (essentially truncating your layer) and then Append (Developer reference: Append (Feature Service)—ArcGIS REST API | ArcGIS for Developers) a FGDB copy of the up-to-date Enterprise GDB dataset to the Feature Layer. This would be advantageous because you wouldn't need to detect changes in the Enterprise Geodatabase, and this workflow works with Sync-enabled layers and offline replicas. Something to keep in mind is that with this workflow, when the FGDB is appended to the empty layer it creates new records. You would want to make sure that any workflows using the feature layer don't depend on Object ID or Global ID. As you mentioned your feature layer is used as only a reference layer offline, so while syncing back features that have since been truncated/appended would create a new feature (possibly resulting in a duplicate), this does not appear to be consequential.
I will say that best practices and examples for updating data in ArcGIS Online is something that we're looking to put out a series of detailed blogs on. The variety of different scenarios (e.g. update frequency, source data, IT setup, workflows the feature layer is used in, etc.) that require a different data update approach has made a recommendation of a single best practice challenging, but we are hoping that the blog series will help fill this gap a little bit. It will contain info on applyEdits, append, distributed collaboration, and a few other methods as well.
I will say that best practices and examples for updating data in ArcGIS Online is something that we're looking to put out a series of detailed blogs on.
This would be useful!
I've created a simple model for 'delete rows' & append new data. I've tested it out & it works fine. New features pop-up on the Collector app in offline mode (once synchronised). Will be testing it out for the cadastra dataset — which is quite large.
I was hoping ArcGIS Pro would have an out-of-the-box update methodology for sync-enabled layers. But I appreciated there are many varied scenarios for updating data — as you mentioned.
What's considered a 'small number of edits'? A blog series on this and the pros and cons of Collaboration would be very useful. I've heard that Collaboration doesn't work well if data is updated via delete rows/truncate and append in the Enterprise Geodatabase.
It is not recommended to commit more than 2,000 edits per request using applyEdits.
You are correct that distributed collaboration would be less performant when truncating and appending in the Enterprise GDB. The reason for this is that if you truncate/append in the Enterprise GDB, when the replica is synced to Online it will be the entire dataset. Without truncating/appending in Enterprise, only the first sync would be the entire dataset and subsequent ones are just deltas, meaning fewer records and faster sync times.
I hope this helps, and I appreciate the blog suggestion.