Consolidate Layer (Data Management)
Summary
Consolidates one or more layers by copying all data and referenced data sources into a single folder.
Illustration
Usage
A warning is issued when this tool encounters an unsupported layer type (a schematics or tool layer). The unsupported layer will not be written to the output.
When consolidating or packaging layers, the resulting layers will be renamed using the convention integer + layername (for example, 0001fGDB_Polylayer.lyr). The numbered sequence is added to maintain the ordering of the layers as they appear in the table of contents. The lower the number, the higher the layer will appear in the table of contents when the package is unpacked.
When Convert Data to File Geodatabase is checked
- Each data source will have a unique file geodatabase created in the consolidated folder.
- Compressed raster and vector formats will be converted to file geodatabase, and compression will be lost.
When Convert Data to File Geodatabase is unchecked
- The format of the input layers will be preserved with one exception; layers that reference data in a personal geodatabase are always converted to file geodatabase.
- Every data source will preserve its original format. File geodatabases will be consolidated into a version-specific folder, and all other formats will be consolidated in the commonData folder.
- Layers that point to ArcSDE data sources will preserve their connection information and remain pointing to the ArcSDE data source in the consolidated folder or package.
- ADRG, CADRG/ECRG, CIB, and RPF raster formats will always convert to file geodatabase rasters. ArcGIS cannot natively write out these formats. They will always be converted to File Geodatabase rasters for efficiency.
- Compressed raster and vector formats will not be clipped, even if an extent is specified in the Extent parameter.
-
For layers that contain a join or participate in a relationship class, all joined or related data sources will be consolidated into the output folder.
-
For feature layers, the Extent parameter is used to select the features that will be consolidated. For raster layers , the Extent parameter is used to clip the raster datasets.
-
Some datasets reference other datasets. For example, you may have a Topology dataset that references four feature classes. Other examples of datasets that reference other datasets include Geometric Networks, Networks, and Locators. When consolidating or packaging a layer based on these types of datasets, the participating datasets will also be consolidated or packaged.
The Schema Only parameter, if checked, will only consolidate the schema of the input data source(s). A schema is the structure or design of a feature class or table that consists of field and table definitions, coordinate system properties, symbology, definition queries, and so on. Data or records will not be consolidated.
Data sources that do not support schema only will not be consolidated or packaged. If the Schema Only parameter is checked and the tool encounters a layer that is not supported for schema only, a warning message is displayed, and that layer will be skipped. If the only layer specified is unsupported for schema only, the tool will fail.
Consolidating or packaging Coverage or VPF layers will copy the entire Coverage or VPF dataset into the consolidated folder or package.
Syntax
Parameter | Explanation | Data Type |
in_layer [in_layer,...] |
The input layer(s) that will be consolidated. | Layer |
output_folder |
The output folder that will contain the layer files and consolidated data. | Folder |
convert_data (Optional) |
Specifies whether input layers will be converted into file geodatabase or preserve their original format.
| Boolean |
convert_arcsde_data (Optional) |
Specifies whether input layers will be converted into file geodatabase or preserve their original format.
| Boolean |
extent (Optional) |
Specify the extent by manually entering the coordinates in the extent parameter using the format X-Min Y-Min X-Max Y-Max. Additionally, to use the extent of a specific layer, simply add the layer name for the extent parameter.
| Extent |
apply_extent_to_arcsde (Optional) |
Specifies the extent that will be used to select ArcSDE data sources.
| Boolean |
schema_only (Optional) |
Specifies whether the schema of the input layers will be consolidated or packaged.
| Boolean |
Code Sample
The following Python window script demonstrates how to use the ConsolidateLayer tool in immediate mode.
import arcpy arcpy.env.workspace = "C:/arcgis/ArcTutor/BuildingaGeodatabase/Layers" arcpy.ConsolidateLayer_management('Parcels.lyr', 'Consolidate_folder', "PRESERVE", "CONVERT_ARCSDE", "#", "ALL","ALL")
Finds and creates individual consolidated folders for all of the layer files that reside in a specified folder.
# Name: ConsolidateLayerEx1.py # Description: Find all the layer files that reside in a specified folder and create a consolidated folder for each layer file. # Author: ESRI # import system modules import os import arcpy from arcpy import env # Set environment settings env.overwriteOutput = True env.workspace = "C:/arcgis/ArcTutor/BuildingaGeodatabase/Layers" # Loop through the workspace, find all the layer files (.lyr) and create a consolidated folder for each # layer file found using the same name as the original layer file. for lyr in arcpy.ListFiles("*.lyr"): print "Consolidating " + lyr arcpy.ConsolidateLayer_management(lyr, os.path.splitext(lyr)[0], "PRESERVE", "CONVERT_ARCSDE", "#", "ALL", "ALL")
Finds and creates a single consolidated folder for all of the layer files that reside in a specified workspace.
# Name: ConsolidateLayerEx2.py # Description: Find all the layer files that reside in a specified folder and create a single # consolidated folder that will contain all layers found. # Author: ESRI # import system modules import os import arcpy from arcpy import env # Set environment settings env.overwriteOutput = True env.workspace = "C:/arcgis/ArcTutor/BuildingaGeodatabase/Layers" # Find all the layer files (.lyr) in a workspace and create a single consolidated folder lyrs = arcpy.ListFiles("*.lyr") arcpy.ConsolidateLayer_management(lyrs, 'all_layers',"PRESERVE", "CONVERT_ARCSDE", "#", "ALL", "ALL")