How To: Update a hosted feature layer in ArcGIS Online with data from an external feature class
In some cases, such as in a continuous project that requires frequent updates, a hosted feature layer must be constantly updated with data from an external feature class each time there is new data. For example, an existing hosted feature layer containing data of tree distribution in a forest must be updated with data from an external feature class containing records of new trees. The Load Data tool can be used to load the new data from the external feature class to the existing hosted feature layer, provided that the hosted feature layer and the external feature class have the same field schema and both contain a Global ID field.
The instructions provided describe how to update a hosted feature layer in ArcGIS Online with data from an external feature class in ArcMap.
The following figure shows an example of some attributes of a hosted feature layer in ArcGIS Online that must be updated with new data from the external feature class. The existing hosted feature layer contains 19 point features representing the distribution of trees within an area.
In ArcMap, add Global IDs to the external feature class containing the data to load to the hosted feature layer using the Add Global IDs tool, as follows.
Global IDs can also be added from ArcCatalog by right-clicking the feature class and going to Manage > Add Global IDs.
In the ArcToolbox window, navigate to Data Management Tools > Distributed Geodatabase > Add Global IDs.
In the Add Global IDs dialog box, select the feature class for Input Datasets.
Create an empty feature class with the same field schema as the external feature class. When defining the fields for the new feature class, click the Import button, and browse for the external feature class to import the field schema to the new feature class.
Publish the new empty feature class to ArcGIS Online as a hosted feature layer. For steps on publishing hosted feature layers from ArcMap, refer to Publish from ArcMap.
When publishing the feature layer, ensure that the Create, Delete, and Update capabilities are enabled to allow the creation of a local copy of the feature layer in a later step.
In a new map document, add the published empty feature layer to ArcMap using the steps below:
Sign in to ArcGIS Online by clicking File > Sign In on the ArcMap main menu.
In the Catalog window, expand My Hosted Services.
Select the published feature layer, and drag the feature layer to the Table Of Contents window.
Create a local copy of the feature layer to make edits on the local file geodatabase copy of the feature layer. With the Table of Contents in List by Drawing Order, right-click the group layer containing the feature layer and navigate to Edit Features > Create Local Copy for Editing.
Load the data from the external feature class to the local copy of the feature layer created in Step 5, using the steps below.
It is essential to run the Load Data operation in the same ArcMap session. Closing ArcMap to complete the steps later might require repeating the workflow from the beginning.
In the Catalog window, browse for the local copy of the feature layer. The local copy is stored by default in Documents > ArcGIS > FeatureServiceLocalEdits.The path for the local copy is available in the Table Of Contents window when selecting the List By Source mode.
Right-click the feature class in the local copy, and navigate to Load > Load Data to update the local copy using the Simple Data Loader wizard.
Click the Refresh button to view the edits in the data frame.
To sync the edits made to the feature layer with the existing hosted service, right-click the updated group layer containing the feature layer in the Table of Contents, and navigate to Edit Features > Synchronize Local Edits with Server.
The following figure shows the attributes of the hosted feature layer that has been updated with data from an external feature class. The number of features in the hosted feature layer is now 30 features.