Label | Explanation | Data Type |
Input Project | The project (.aprx file) to be packaged. | File |
Output File | The output project package (.ppkx file). | File |
Share outside of organization (Optional) | Specifies whether the project will be consolidated for your internal environment or will move all data elements so it can be shared externally. Note:Data and maps will be consolidated and packaged if the project references them from a local path, such as c:\gisdata\landrecords.gdb\, regardless of this parameter's setting.
| Boolean |
Package as template
(Optional) | Specifies whether a project template or a project package will be created. Project templates can include maps, layouts, connections to databases and servers, and so on. A project template can be used to standardize a series of maps for different projects and to ensure that the correct layers are immediately available for everyone to use in their maps.
| Boolean |
Extent
(Optional) | Specifies the extent that will be used to select or clip features.
| Extent |
Apply Extent only to enterprise geodatabase layers
(Optional) | Specifies whether the specified extent will be applied to all layers or to enterprise geodatabase layers only.
| Boolean |
Additional Files (Optional) | Adds files to a package. Additional files, such as .doc, .txt, .pdf, and so on, are used to provide more information about the contents and purpose of the package. | File |
Summary
(Optional) | Adds summary information to the properties of the package. | String |
Tags
(Optional) | Adds tag information to the properties of the package. Multiple tags can be added, separated by a comma or semicolon. | String |
Package version (Optional) | Specifies the version of the geodatabases that will be created in the resulting package. Specifying a version allows packages to be shared with earlier versions of ArcGIS and supports backward compatibility. Note:A package saved to an earlier version may lose properties that are only available in the later version.
| String |
Include Toolboxes
(Optional) | Specifies whether project toolboxes, and the data referenced by the tools in the project toolboxes, will be consolidated and included in the output package. All projects require a default toolbox, and the default toolbox will be included regardless of this setting. A toolbox in a connected folder is not considered a project toolbox and is not impacted by this setting.
| Boolean |
Include History Items
(Optional) | Specifies whether geoprocessing history items will be consolidated and included in the output package. Included history items will consolidate the data required to reprocess the history item.
| String |
Read Only Package
(Optional) | Specifies whether the project will be read-only. Read-only projects cannot be modified or saved.
| Boolean |
Keep only the rows which are related to features within the extent
(Optional) | Specifies whether the specified extent will be applied to related data sources.
| Boolean |
Preserve Mobile Geodatabase
(Optional) | Specifies whether input mobile geodatabase data will be preserved in the output or written to file geodatabase format. This parameter overrides the Convert data to file geodatabase parameter when the input data is mobile geodatabase. If the input data is a mobile geodatabase network dataset, the output will always be mobile geodatabase.
| Boolean |
Summary
Consolidates and packages a project file (.aprx) of referenced maps and data to a packaged project file (.ppkx).
Usage
All elements of a project are consolidated into the project package (.ppkx), including maps and 3D views, the data and layers in the maps, toolboxes, geoprocessing history items, styles, layouts, and folders or connections (server, workflow, and so on) when appropriate.
Project packages are created for internal use by default. The Share outside of organization parameter allows you to control whether a package will be created for internal (inside your organizations network) or external use. When Share outside of organization is checked, enterprise geodatabase layers and data referenced from a UNC path will be included in the project package.
Note:
Data sources must be referenced from either an enterprise geodatabase or a UNC file path to create an internal package where the data remains referenced. Local data paths will always be consolidated and packaged. Creating an internal package where data is only referenced will open with broken links if shared outside your environment or to colleagues who do not have access to either the enterprise geodatabase or the UNC data shares.
Templates can be created using the Package as template parameter. You can use a project template (.aptx file) to create a project by defining layers, maps, and data as well as required connections.
Toolboxes that are part of a project are analyzed using the Analyze Tools for Pro tool before the consolidation process is performed. Identified errors will stop the consolidation process. You must either fix the errors or remove the tool from the project. Input data used by the tool will be consolidated, regardless of whether the data is part of a map in the project. Toolboxes can be excluded from the output project package by unchecking the Include Toolboxes parameter.
Similar to project toolboxes, geoprocessing history (the result information from running a geoprocessing tool) will be included in the package. Data required to process the history item will be included in the output package regardless of whether it exists in a map or scene. Any history items that are invalid (failed during processing) or where data cannot be found will cause the packaging process to stop. You must remove or fix the history item in question. History items can be excluded from a project package by unchecking the Include History Items parameter.
Connections—such as folder, server, database, and workflow—will only be included in an internal package. These items are removed if the package is created to be shared outside your organization.
Items such as attachments, styles, and tasks will be referenced for internal packages if they were part of the project from a UNC path. These items will be copied and packaged in all other situations.
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.
Files that document maps and data or provide additional information can be included in the package. Images, PDFs, word documents, and .zip files can be included in the package by referencing them with the Additional Files parameter.
Caution:
Project packages (.ppkx files) can only be created and opened with ArcGIS Pro.
Parameters
arcpy.management.PackageProject(in_project, output_file, {sharing_internal}, {package_as_template}, {extent}, {apply_extent_to_arcsde}, {additional_files}, {summary}, {tags}, {version}, {include_toolboxes}, {include_history_items}, {read_only}, {select_related_rows}, {preserve_sqlite})
Name | Explanation | Data Type |
in_project | The project (.aprx file) to be packaged. | File |
output_file | The output project package (.ppkx file). | File |
sharing_internal (Optional) | Specifies whether the project will be consolidated for your internal environment or will move all data elements so it can be shared externally.
| Boolean |
package_as_template (Optional) | Specifies whether a project template or a project package will be created. Templates can include maps, layouts, connections to databases and servers, and so on. A project template can be used to standardize a series of maps for different projects and to ensure that the correct layers are immediately available for everyone to use in their maps. Learn more about project templates
| Boolean |
extent (Optional) | Specifies the extent that will be used to select or clip features.
| Extent |
apply_extent_to_arcsde (Optional) | Specifies whether the specified extent will be applied to all layers or to enterprise geodatabase layers only.
| Boolean |
additional_files [additional_files,...] (Optional) | Adds files to a package. Additional files, such as .doc, .txt, .pdf, and so on, are used to provide more information about the contents and purpose of the package. | File |
summary (Optional) | Adds summary information to the properties of the package. | String |
tags (Optional) | Adds tag information to the properties of the package. Multiple tags can be added, separated by a comma or semicolon. | String |
version [version,...] (Optional) | Specifies the version of the geodatabases that will be created in the resulting package. Specifying a version allows packages to be shared with earlier versions of ArcGIS and supports backward compatibility. Note:A package saved to an earlier version may lose properties that are only available in the later version.
| String |
include_toolboxes (Optional) | Specifies whether project toolboxes will be consolidated and included in the output package. All projects require a default toolbox, and the default toolbox will be included regardless of this setting.
| Boolean |
include_history_items (Optional) | Specifies whether geoprocessing history items will be consolidated and included in the output package. Included history items will consolidate the data required to reprocess the history item.
| String |
read_only (Optional) | Specifies whether the project will be read-only. Read-only projects cannot be modified or saved.
| Boolean |
select_related_rows (Optional) | Specifies whether the specified extent will be applied to related data sources.
| Boolean |
preserve_sqlite (Optional) | Specifies whether mobile geodatabase data will be preserved in the output or written to file geodatabase format. This parameter overrides the convert_data parameter when the input data is mobile geodatabase. If the input data is a mobile geodatabase network dataset, the output will always be mobile geodatabase.
| Boolean |
Code sample
The following Python script demonstrates how to use the PackageProject function from the Python window.
import arcpy
p = arcpy.mp.ArcGISProject("CURRENT")
arcpy.management.PackageProject(p.filePath, 'E:\\gisShare\\projects\\Pipelines\\SE_Pipeline.ppkx', 'INTERNAL')
The following Python script turns all projects from a directory, with the word "oil" in the file name, into a project package (.ppkx).
import os
import arcpy
enterpriseProjectDir = "\\\\centralFileServer\\gisData\\ArcGISProProjects"
sharedProjectDir = "c:\\publicFiles\\sharedProjects"
walk = arcpy.da.Walk(enterpriseProjectDir, datatype="Project")
for dirpath, dirnames, filenames in walk:
for filename in filenames:
if "OIL" in filename.upper():
project = os.path.join(dirpath, filename)
outputFile = os.path.join(sharedProjectDir, os.path.splitext(os.path.basename(project))[0] + ".ppkx")
print("Packaging: {0} to {1}".format(project, outputFile))
arcpy.management.PackageProject(project, outputFile, "EXTERNAL")
Environments
Special cases
- Parallel Processing Factor
If the environment is not specified, the tool will use one half of the available cores.
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes