Merge multiple layers into one

Video

This tutorial is also available as a video.

Configure the merge tool

The Merge geoprocessing tool can merge together two or more layers, so long as they are of the same feature type. For example, it can merge two line layers but not a line layer with a polygon layer. You'll use it to merge two polygon layers representing land.

  1. Download the Norway project package.

    A file named Norway.ppkx is downloaded to your computer. A .ppkx file is an ArcGIS Pro project package and may contain maps, data, and other files that you can open in ArcGIS Pro.

  2. Locate the downloaded file on your computer. Double-click Norway.ppkx to open it in ArcGIS Pro. If prompted, sign in with your ArcGIS account.
    Note:

    If you don't have access to ArcGIS Pro or an ArcGIS organizational account, see options for software access.

    A map of Norway appears.

    Map of Norway

    The map contains two polygon layers: NorwayLand (in light green) and NorwayMinorIslands (in dark green).

    Detail of map of Norway

    Note:

    The data for this map is from Natural Earth.

    For your project, it would be easier to manage all of the land polygons as a single layer, not two. You'll use the Merge geoprocessing tool to create a new layer containing all of the land areas.

  3. On the ribbon, click the Analysis tab. In the Tools group, click the expand button.

    Analysis tab and expand button on Tools gallery

    A gallery appears, listing some of the more commonly used tools.

  4. Scroll down. In the Manage Data group, click Merge.

    Merge button in the Tools gallery

    The Geoprocessing pane appears with the parameters for the Merge tool. This tool combines multiple input layers into a single, new output layer.

    Merge tool illustration

    Tip:

    To read more about the Merge tool, click the help button in the Geoprocessing pane.

    Help button

  5. In the Geoprocessing pane, for Input Datasets, choose NorwayLand and NorwayMinorIslands.

    The Output Dataset field updates to NorwayLand_Merge.

  6. Click the Output Dataset field.

    A path is revealed. By default, the new dataset will be stored in the project's geodatabase.

    Path in Output Dataset field

    You'll accept the default location and name for the output dataset.

Configure the field map

If you know that your input layers have all matching fields, you can run the tool now. However, often you need to merge layers with nonmatching fields. That is the case here. You'll use the Field Map parameters to make sure the layers are merged correctly without losing any important attribute information.

  1. In the Geoprocessing pane, under Field Map, click the Reset button.

    Reset button

    The reset ensures that fields from both input layers are included in the Field Map.

  2. Under Output Fields, click featurecla (2).

    The (2) label tells you that there are two source fields contributing to this output field.

    Field Map for featurecla field

    The information under Source tells you that both input layers have fields named featurecla. The contents of these two fields will be merged into a new featurecla field in the output layer.

  3. Under Output Fields, click min_zoom.

    min_zoom field

    There is only one source for this field, from the NorwayLand layer.

    You'll view the attribute tables to see if the NorwayMinorIslands layer has an equivalent field with a different name.

  4. In the Contents pane, right-click NorwayLand and click Attribute Table.

    Attribute Table in the layer's context menu

    The attribute table appears.

    Tip:

    You can also open an attribute table by selecting the layer and pressing Ctrl+T.

  5. Open the attribute table for the NorwayMinorIslands layer as well.
  6. Above the attribute tables, right-click the NorwayMinorIslands tab and click New Horizontal Tab Group.

    New Horizontal Tab Group in the table's context menu

    You can now view both tables at the same time. The min_zoom and zoom_level fields contain similar information. Both fields recommend zoom levels for displaying the features on web maps.

    min_zoom and zoom_level fields in the attribute tables

    You'll merge these two fields into one in the output layer.

  7. In the Geoprocessing pane, under Source, click Add New Source.

    Add New Source button

  8. Under Tables, click NorwayMinorIslands. Under Fields, check the zoom_level check box. Click Add Selected.

    Add New Source window

    Now both the min_zoom and zoom_level fields will contribute to the new field in the output layer.

  9. Under Output Fields, click ORIG_FID.

    Only one of the tables contains this field. You don't need this field in your new layer, so you'll remove it.

  10. Point to ORIG_FID and click the Remove button.

    Remove button

  11. Also remove the zoom_level field.

    You have already included the zoom_level values in the min_zoom field.

    The last field without a (2) label is Name. In the attribute tables, you can see that many of the minor islands have a recorded name, but no name field is present in the NorwayLand layer.

    Name field in the NorwayMinorIslands attribute table

    You'll keep Name as an output field. It is okay that it has only one source field.

    Field map for the Name field

  12. Leave the Add source information to output check box unchecked.

    In the attribute tables, you can see that all features from the NorwayLand layer have the value Land for the featurecla field, and all features from the NorwayMinorIslands layer have the value Minor island. This field will tell you the source layer, so adding extra source information is not necessary.

  13. Click Run.

    The tool runs and a new layer named NorwayLand_Merge appears in the Contents pane.

    A warning appears at the bottom of the Geoprocessing pane.

Fix errors

The merge was not successful. On the map, you can see that the minor islands are still dark green. They were not included in the new merged layer.

NorwayLand_Merge layer in the Contents pane and on the map

You'll read the warning to find out what went wrong.

  1. In the Geoprocessing pane, on the warning, click View Details.

    View Details link

    A window appears with the following warning message: Failed on input OID 10, could not write value 'Minor island' to output field featurecla.

    Warning 001156

    You'll investigate the featurecla field for the cause of this message.

  2. Close the message window.
  3. In the Geoprocessing pane, under Output Fields, click featurecla (2).

    Under Source, nothing looks unusual.

  4. Click Properties.

    Properties tab

    Here you can see that the field's Type value is Text and its Length value is 11. These properties were borrowed from the first input dataset: NorwayLand. Eleven characters is long enough to store the word Land but not long enough to store the words Minor island.

  5. For Length, type 12.

    Length set to 12 characters

    You'll also change the name and alias so the meaning of this field is more clear in the output dataset.

  6. For Field Name, type source. For Alias, type Source Layer.

    Field Name and Alias

  7. Click Run.

    The NorwayLand_Merge layer on the map refreshes. Because you did not change the Output Dataset name, the one you created earlier was overwritten. This time it covers all of the islands.

    NorwayLand_Merge layer in the Contents pane and on the map

  8. Open the attribute table for the NorwayLand_Merge layer.
  9. Scroll through the table to confirm that it contains features from both input layers, and that the fields were merged correctly.

    NorwayLand_Merge attribute table

  10. Close all three attribute tables.
  11. In the Contents pane, right-click NorwayLand and click Remove.

    Remove in the layer's context menu

  12. Also remove the NorwayMinorIslands layer.
  13. On the Quick Access Toolbar, click Save.

    Save button

You have merged two polygon layers into one new layer. You used a field map to determine how mismatched fields would be merged and formatted in the new layer.