PROBLEM
In ArcGIS Pro, it is possible to overwrite an ArcGIS Online sync-enabled hosted feature layer and have it still be sync-enabled after the overwrite. However, there are instances when the sync-enabled hosted feature layer cannot be overwritten.
The hosted feature layer contains replicas after offline areas are created in the ArcGIS Field Maps mobile app, ArcGIS Field Maps Designer, or ArcGIS Online. This behavior is similar to the documented error, 001989: Service cannot be overwritten if Sync is enabled and replicas exist.
Use one of the following methods to remove offline areas so that a sync-enabled hosted feature layer can be overwritten.
Refer to ArcGIS Field Maps: Delete a map for instructions to delete offline areas.
Note: Use ArcGIS Notebooks to run the Python script.
from arcgis.gis import GIS from arcgis.mapping import WebMap gis = GIS('home')
offline_map_item_id = '<MAP_ITEM_ID>' offline_map_item = gis.content.get(offline_map_item_id) offline_map = WebMap(offline_map_item)
for ids in offline_map.offline_areas.list(): print('Removing map area: ' + ids.title) ids.delete()
The code block below demonstrates the full script.
from arcgis.gis import GIS from arcgis.mapping import WebMap gis = GIS('home') offline_map_item_id = '694b23c51eca4d7c8245b98ac13165e8' offline_map_item = gis.content.get(offline_map_item_id) offline_map = WebMap(offline_map_item) for ids in offline_map.offline_areas.list(): print('Removing map area: ' + ids.title) ids.delete()
Get help from ArcGIS experts
Download the Esri Support App