Tuesday, July 19, 2011

Create a Layer Package

The layer package allows users to consolidate all your data resources into a single folder or compressed file.  The tools help users organize data that can be spread across the network.  The layer package also allows users to Share data by making it easy to publish the package to ArcGIS.com. 


Some interesting notes:

  • Layer packages are backwards compatible with ArcGIS 9.3.1.

  • A warning is issued when this tool encounters an unsupported layer type (a schematics or tool layer).

  • 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.
  • The Schema Only parameter, if checked, will only consolidate the schema of the input data source(s).



Example of Consolidating all Layers:

import arcpy
import os

env.workspace = r"c:\temp"
listLayers = arcpy.ListFiles("*.lyr")
arcpy.PackageLayer_management(listLayers, 'packagelayers.lpk', "PRESERVE", "CONVERT_ARCSDE", "#", "ALL", "ALL", "CURRENT")