How To: Retain all attachments when merging hosted feature layers
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.
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.
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.
- 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.
- In the hosted feature layer Item Details page, click Export Data > Export to FGDB.
- 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.
- 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.
- In ArcMap, make a local copy of the hosted feature layer to be the target dataset in the Append tool.
- 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.
- 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.
- In ArcToolbox, navigate to Data Management Tools > General > Append.
- In the Append dialog box, select the feature class from the downloaded file geodatabase as Input Datasets.
- Select the local copy of the target hosted feature layer for the Target Dataset.
- Click Environments, and click Geodatabase. Ensure the option for Maintain Attachments is checked, and click OK.
- Click OK to execute the tool. All features and attachments from the input feature class are appended to the target feature layer.
- 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.
- 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.
- ArcMap Help: Maintain Attachments (Environment setting)
- How To: Retain all attachments when combining feature classes containing attachments using the Append tool
- How To: Download a large hosted feature service with attachments from a REST endpoint
- How To: Retrieve attachments from a hosted feature service
- Problem: Unable to export a feature layer with attachments from ArcGIS Online for Organizations to a file geodatabase
- Problem: Unable to export a large hosted feature service with attachments to a file geodatabase from a REST endpoint
Last Published: 6/12/2018
Article ID: 000018185
Software: ArcMap 10.5.1, 10.5