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")

2 comments:

- jj said...

Hi,

I think this is a noob question but I cannot find this anywhere in the net.

I did batch processing using ArcPy of Service Area Analysis. I simply followed the sample script on ArcGIS10.

The problem is the output are Service Area layers, and I don't know how to work with them using ArcPy as I need to select the Polygon datasets and continue with other processing.

Basically, I would have a list of

StoreCoverage_1.lyr

and when I open them using ArcMap, it has the datasets:

- Facilities
- Point Barriers
- Lines
- Polygons
- Polygon Barriers

I wanted to select attributes using the Polygons. How do I do that (in ArcPy)?

I hope you could help because I am really desperate about this?

Thank you.

Andrew said...

I think you have to use the getOutput() function on the results object to pull out results from na functions.