The Merge Layers tool combines two feature layers to create a single output layer. The tool requires that both layers have the same geometry type (tabular, point, line, or polygon). If time is enabled on one layer, the other layer must also be time enabled and have the same time type (instant or interval). The result will always contain all fields from the input layer. All fields from the merge layer will be included by default, or you can specify custom merge rules to define the resulting schema.
Workflow diagram
Analysis using GeoAnalytics Tools
Analysis using GeoAnalytics Tools is run using distributed processing across multiple ArcGIS GeoAnalytics Server machines and cores. GeoAnalytics Tools and standard feature analysis tools in ArcGIS Enterprise have different parameters and capabilities. To learn more about these differences, see Feature analysis tool differences.
Example
The City of Los Angeles wants to restore the area around the Los Angeles River by developing a new park. The park must be near the Los Angeles River but not within a close proximity to existing parks or toxic release facilities. Buffers around the existing parks and toxic release facilities can be merged into a single layer using Merge Layers to create an exclusion zone where a new park cannot be developed.
Usage notes
Two inputs of the same geometry type and time type are required.
All of the fields from both inputs will be copied to the output by default. Optionally, you can choose to modify the fields from the merge layer using the Rename, Remove, and Match operations.
Operation | Description | Example |
---|---|---|
Rename | The field will be renamed in the output. A text box will appear where the new name can be specified. | A user wants to merge two layers, each with a field named COUNT. This field represents a count of individuals in one layer but a count of families in the other. The two COUNT fields will be merged by default because they have a matching field name. Using Rename, the name of the field in the merge layer can be changed to MERGE_COUNT to keep the two fields separate in the result layer. |
Remove | The field will be removed from the output. | A user wants to merge two layers but does not want to preserve some fields in the merge layer, such as OBJECTID. Using Remove, they can prevent those fields from being written to the result layer and keep only fields of interest. |
Match | The field names are made equivalent. Values of the field from the layer to merge will be copied to the matched output field. | A user wants to merge two tabular layers of survey results. The input layer has a field named Name that contains the names of survey participants. An equivalent field in the merge layer is named Participant. Using Match to indicate that these fields are equivalent, both will be merged into a single field named Name in the result layer. |
If the input layer and merge layer contain fields with matching names but mismatched field types, the tool will fail unless the two field types can be successfully merged. If the input field is string and the merge field is numeric, the fields will be merged into a single string field in the output layer. If the input field is a double and the merge field is numeric, the fields will be merged into a single double field in the output layer. In all other cases, merging attributes must be used to rename or remove one of the matching fields in order to run the tool.
Limitation
- The features in the merge layer must have the same geometry type and time type as features in the input layer.
ArcGIS API for Python example
The Merge Layers tool is available through ArcGIS API for Python.
This example merges census blocks from two states into one output layer.# Import the required ArcGIS API for Python modules
import arcgis
from arcgis.gis import GIS
# Connect to your ArcGIS Enterprise portal and check that GeoAnalytics is supported
portal = GIS("https://myportal.domain.com/portal", "gis_publisher", "my_password", verify_cert=False)
if not portal.geoanalytics.is_supported():
print("Quitting, GeoAnalytics is not supported")
exit(1)
# Find the big data file share dataset you're interested in using for analysis
search_result = portal.content.search("", "Big Data File Share")
# Look through search results for a big data file share with the matching name
bd_file = next(x for x in search_result if x.title == "bigDataFileShares_CensusBlocks")
# Look through the big data file share for IllinoisBlocks and WisconsinBlocks
il_block = next(x for x in bd_file.layers if x.properties.name == "IllinoisBlocks")
wi_block = next(x for x in bd_file.layers if x.properties.name == "WisconsinBlocks")
# Define merge attributes so that the field "State_Code" is matched to the field "statecode"
merge_info = [{"mergeLayerField" : "State_Code", "mergeType" : "Match", "mergeValue" : "statecode"}]
# Run the tool Merge Layers
merge_result = arcgis.geoanalytics.manage_data.merge_layers(input_layer = il_block,
merge_layer = wi_block,
merge_attributes = merge_info,
output_name = "IL_WI_Census_Blocks")
# Visualize the tool results if you are running Python in a Jupyter Notebook
processed_map = portal.map()
processed_map.add_layer(merge_result)
processed_map
Similar tools
Use the ArcGIS GeoAnalytics Server Merge Layers tool to combine two feature layers into a new output layer. Other tools may be useful in solving similar but slightly different problems.
Map Viewer analysis tools
Append data to a feature layer without creating a new output layer using the ArcGIS GeoAnalytics Server Append Data tool.
Select and copy data to a new feature layer in your portal using the ArcGIS GeoAnalytics Server Copy To Data Store tool.
Calculate values for features in a new or existing field using the ArcGIS GeoAnalytics Server Calculate Field tool.
ArcGIS Desktop analysis tools
To run this tool from ArcGIS Pro, your active portal must be Enterprise 10.7 or later. You must sign in using an account that has privileges to perform GeoAnalytics Feature Analysis.
Perform similar append operations in ArcGIS Pro with the Merge geoprocessing tool.