Extracting and Overwriting a Hosted Service in ArcGIS Online


Publishing maps to ArcGIS Online as hosted feature services is a powerful way of collaborating on projects and sharing data and information over the web. The process of creating these data and services is often an iterative process that requires some trial an error to get right. This is especially true when creating services when using platforms such as ArcGIS Collector for field data collection. We regularly need to add fields, change default values, adjust domains and subtypes, etc after our first trip into the field which can lead to some problems when trying to get data in and out of ArcGIS Online. There is currently no way to directly update things like default values, domains, and subtypes through the ArcGIS Online user interface so these changes have to be made in ArcGIS Desktop and republished as services. The good thing is that you can overwrite an existing service in ArcGIS Online and as long as the fields still exist and the map layers stay in the same order, your apps should still work! In order to do this, you need to get all the new features, attributes, and attachments (photos) that have been collected in the field and now reside in Esri’s “cloud” back down to your computer so that you can make the changes and republish. The first thought is that you can just use the Export button available on the Item Details page, but this feature does not currently export the attachments (such as photos) or the domains and subtypes. The steps below show how to get the complete geodatabase schema out of ArcGIS so that you can make necessary adjustments and republish.

0) Make sure you have the Sync property enabled on your service by going to the item details page in ArcGIS Online and clicking the Edit button. Scroll to the bottom of the page to find the Enable Sync checkbox.

1) Connect to your ArcGIS Online hosted services in ArcMap by going to the Catalog Tree and then navigating down to My Hosted Services. If you haven’t logged into ArcGIS Online, do so by right-clicking on My Hosted Services and selecting Sign In.

2) Find the service you would like to modify and drag it into ArcMap. This will add a group layer with the name of service which contains its layer or layers.

3) We will now use the disconnected editing with synchronization features to download the complete geodatabase schema. Right click the service’s group layer and navigate down to Edit Features > Create Local Copy For Editing. This will download the data to your computer with attachments,domain, and subtypes! This very cool feature is meant to be used so you can edit features directly in ArcMap in a disconnected environment and then sync the changes back up to the service. This syncing option will fail if the schema has changed however so we’ll have to try something else.

4) Double-click a layer in the service group layer to open the Layer Properties dialog. Find the Source tab and then copy the long path next to the Database property. This is where the geodatabase is.

5) Copy this path into the location box in the Catalog view and you will see the contents of the geodatabase. Copy this geodatabase to a more useful location (or maybe even overwrite the original source gdb that you published from to keep any mxd’s intact) and make any necessary changes to the schema.

6) You can then recreate the map and republish using the overwrite option and as long as the layers are in the same order the connected web maps and apps should continue to work without issue. NOTE: The service must be at the root of your My Content page when you overwrite it. We have found a bug in the publishing tools when overwriting an ArcGIS Online hosted service that will cause a publishing error when overwriting a service that is nested in a folder in your My Content list. You can always move content from one folder to another without affecting your maps and apps so if the service is in a folder: move it to the root, overwrite it, and move it back. 

Happy Mapping!

Category: ArcGIS, Help Sheets, Workflows, and Lessons
Tags: , , , , , ,

← All Resources