English

How To: Retain all attachments when merging hosted feature layers

Summary

Managing hosted feature layers in ArcGIS Online may require features and attachments to be appended to another hosted feature layer. However, when hosted feature layers with attachments are merged using the Merge Layers tool in ArcGIS Online, the attachments are dropped.

To avoid this issue, use the Merge or Append tool in Pro or ArcMap instead. These desktop tools can merge the features with the attachments in the hosted feature layers into one hosted feature layer. Beginning with ArcMap 10.5 and ArcGIS Pro 2.0, an environment setting for Maintain Attachments is available, which can be used to copy attachments from input features to output features. 

Procedure

The image below is an example of attributes with attachments in a hosted feature layer that must be merged with another hosted feature layer and retain all attachments.

An image of attribute fields of a hosted feature layer containing attachments before being appended to another hosted feature layer.

The instructions below describe how to successfully merge hosted feature layers with attachments using the Append tool in ArcMap. When working in ArcMap, hosted feature layers cannot be used as direct input and output for geoprocessing tools. Therefore, the ArcMap workflow requires creating a local copy of the hosted feature layers.

If working with these tools in ArcGIS Pro, hosted feature layers can be used as direct input and output, eliminating the need to make a local copy of the data and republish to a hosted feature layer.

Note: 
The Append tool appends input datasets into a target dataset. It is important to identify which hosted feature layer is the input dataset and which one is the target dataset before merging the hosted feature layers.
  1. In ArcGIS Online, export the hosted feature layer (input dataset) containing the data to append to the target hosted feature layer (target dataset). Use the Export to FGDB option, and download the exported file geodatabase.
    1. In the hosted feature layer Item Details page, click Export Data > Export to FGDB.
    2. In the Export to File Geodatabase window, provide the title, tags, and summary for the file geodatabase. Specify the folder to save the file geodatabase, and click Export.
    3. When the exporting process is complete, click Download to download the file geodatabase. The downloaded file geodatabase contains the feature class with the associated attachments.
    Note: 
    The feature class in the downloaded file geodatabase is used as input for the Append tool in subsequent steps. All features and attachments from this feature layer are appended to a target feature layer.
  2. In ArcMap, make a local copy of the hosted feature layer to be the target dataset in the Append tool.
  3. Add the feature class from the file geodatabase downloaded in Step 1 using the Add Data button or by dragging the feature class from the Catalog. Refer to Adding layers to a map for more information.
  4. Use the Append tool to merge the feature class (input dataset) with the local copy of the hosted feature layer (target dataset) created in Step 2.
    1. In ArcToolbox, navigate to Data Management Tools > General > Append.
    2. In the Append dialog box, select the feature class from the downloaded file geodatabase as Input Datasets.
    3. Select the local copy of the target hosted feature layer for the Target Dataset.

      The Append tool dialog box.
       
    4. Click Environments, and click Geodatabase. Ensure the option for Maintain Attachments is checked, and click OK.

      The Maintain Attachments option.
       
    5. Click OK to execute the tool. All features and attachments from the input feature class are appended to the target feature layer.
  5. Sync the edits made to the target feature layer with the hosted service. Right-click the appended feature layer group layer, and select Edit Features > Synchronize local edits to Server.
  6. In ArcGIS Online, check the Data tab in the item details page of the appended hosted feature layer to ensure all features and attachments are appended.

The following figure shows the attributes of the hosted feature layer that have been appended with features and attachments from another hosted feature layer.

An image displaying the attributes of the appended hosted feature layer containing the retained attachments.

Related Information