English

How To: Update a hosted feature layer in ArcGIS Online with data from an external feature class

Summary

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.

Procedure

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.

An image of the attributes field of a hosted feature layer before being updated with data from an external feature class.
  1. 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.
    Note:
    Global IDs can also be added from ArcCatalog by right-clicking the feature class and going to Manage > Add Global IDs.
    1. In the ArcToolbox window, navigate to Data Management Tools > Distributed Geodatabase > Add Global IDs.
    2. In the Add Global IDs dialog box, select the feature class for Input Datasets.
    3. Click OK.
  2. 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.
    An image of the Import function to import the field schema from an existing feature class
    For more information, refer to the following document: Create a feature class in a database in ArcMap.
  3. 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.
    Note: 
    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.
  4. In a new map document, add the published empty feature layer to ArcMap using the steps below:
    1. Sign in to ArcGIS Online by clicking File > Sign In on the ArcMap main menu.
    2. In the Catalog window, expand My Hosted Services.
    3. Select the published feature layer, and drag the feature layer to the Table Of Contents window.
  5. 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.
    An image of the Create Local Copy for Editing option.
  6. Load the data from the external feature class to the local copy of the feature layer created in Step 5, using the steps below.
    Note: 
    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.
    1. 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.
    2. 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.
  7. Click the Refresh button to view the edits in the data frame.
  8. 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.
An image of the attributes of the updated hosted feature layer containing the attributes of the added features.

Related Information