Summary
Combines feature layers to create a single output layer.
The tool requires that both inputs have the same geometry type (point, line, or polygon) or are tables. 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. The following are examples:
- You have three layers representing the administrative boundaries of England, Wales, and Scotland and want a single layer of Great Britain. You can use Merge Layers to combine the areas and maintain all fields from each area.
- You have two layers containing parcel information for contiguous townships. You want to join them together into a single layer, keeping only the fields that have the same name and type in the two layers.
Illustration

Usage
Both inputs must have the same geometry type (point, line, or polygon) or be tables.
Both inputs must have the same time type (instant or interval) or not be time enabled.
By default, all of the fields from both inputs will be copied to the output. Optionally, you can rename, remove, or match the fields from the merge layer to the input layer.
Syntax
MergeLayers_geoanalytics (input_layer, merge_layer, output_name, {merging_attributes}, {data_store})
Parameter | Explanation | Data Type |
input_layer | The point, line, or polygon features or table to merge with the merge layer. | Record Set |
merge_layer | The point, line, or polygon features or table to merge with the input layer. The merge layer must contain the same feature type and time type as the input layer. | Record Set |
output_name | The name of the output feature service. | String |
merging_attributes [[Merge Field, Action, Input Field],...] (Optional) | A list of values that describe how fields from the merge layer are to be modified and matched with fields in the input layer. All fields from the input layer will be written to the output layer. If no merging attributes are defined, all fields from the merge layer will be written to the output layer. If a field exists in one layer but not the other, the output layer will still contain two fields. The output field will contain null values for the input features that did not have the field. For example, if the input layer contains a field named TYPE but the merge layer does not contain TYPE, the output will contain TYPE, but its values will be null for all the features copied from the merge layer. You can control how fields in the merge layer are written to the output layer using the following merge types:
| Value Table |
data_store (Optional) | Specifies the ArcGIS Data Store where the output will be saved. The default is SPATIOTEMPORAL_DATA_STORE. All results stored to the SPATIOTEMPORAL_DATA_STORE will be stored in WGS84. Results stored in a RELATIONAL_DATA_STORE will maintain their coordinate system.
| String |
Derived Output
Name | Explanation | Data Type |
output | The output layer containing the combined features and attributes from both the input and merge layers. | Record Set |
Code sample
The following Python window script demonstrates how to use the MergeLayers tool.
#-------------------------------------------------------------------------------
# Name: MergeLayers.py
# Description: Merge two layers containing parcel information.
#
# Requirements: ArcGIS GeoAnalytics Server
# Import system modules
import arcpy
# Set local variables
inputFeatures = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/parcels_west/FeatureServer/0"
mergeFeatures = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/east_parcels/FeatureServer/0"
mergingAttributes = [["CODE", "MATCH", "ID"], ["globalid", "REMOVE"]]
outFS = "all_parcels"
dataStore = "SPATIOTEMPORAL_DATA_STORE"
# Execute Merge Layers
arcpy.geoanalytics.MergeLayers(inputFeatures, mergeFeatures, outFS,
mergingAttributes, dataStore)
Environments
- Output Coordinate System
The coordinate system that will be used for analysis. Analysis will be completed on the input coordinate system unless specified by this parameter. For GeoAnalytics Tools, final results will be stored in the spatiotemporal data store in WGS84.
Licensing information
- Basic: Requires ArcGIS GeoAnalytics Server
- Standard: Requires ArcGIS GeoAnalytics Server
- Advanced: Requires ArcGIS GeoAnalytics Server