Сводка
Copies and extracts selected product files to a provided path. A registry key is also set to the provided path that can be used by any of the Defense Mapping tools to obtain paths to the product files.
Использование
This tool is intended for users who have limited, nonadministrative privileges to the Defense Mapping installation folder. Unpacking the Defense Mapping product files to a folder that you have read/write access privileges to allows you to use Defense Mapping tools that require access to the installed product files.
Run this tool after installing Defense Mapping and before running any of the other Defense Mapping tools.
If a custom location is not used, run this tool with C:\Program Files (x86)\ArcGIS\EsriDefenseMapping\<version> as the New Location parameter path.
The tool sets a user registry key value that is only for the current user; if there are multiple users on a single machine, run this tool separately for each user.
This tool will copy files and set a registry key for every user that runs this tool; if all users select the same output location for the files, check the Copy Product Files parameter for each additional user to avoid the product files being copied for every user.
If multiple users run this tool with different output locations, the tool will copy and extract the product files to each of the specified output folders causing an impact on hard drive storage. It is recommended that all users use the same output location and run the tool with the Copy Product Files parameter checked.
If running this tool on a server, it must be run as the ArcGIS user in addition to any named users.
Синтаксис
arcpy.defense.UnpackProductFiles(in_current_folder, in_copy_products, in_new_folder, {in_products})
Параметр | Объяснение | Тип данных |
in_current_folder | The current folder that is set in the registry. If no value is set, the installation directory is the default folder. | String |
in_copy_products | Specifies whether product files will be copied to a new location or the registry key will be updated.
| Boolean |
in_new_folder | The path to the folder that will be used as the product files directory. This path is written to the registry key. | Folder |
in_products (Дополнительный) | The products that will be copied and extracted to the location set in the in_new_folder parameter. | String |
Пример кода
UnpackProductFiles example 1 (Python window)
The following code sample demonstrates running the UnpackProductFiles function for the first time on a machine.
# Importing necessary modules
from arcpy import defense
# Setting parameters
current_folder = r'C:\Program Files (x86)\ArcGIS\EsriDefenseMapping\Desktop10.5'
new_folder = r'C:\Data\ProductFiles'
products ="Geonames;Mgcp;ReferenceData;Tds;VMap1JOG"
# Calling Unpack Product Files tool
defense.UnpackProductFiles(current_folder, "COPY_AND_UPDATE_PATH", new_folder, products)
UnpackProductFiles example 2 (Python window)
The following code sample demonstrates running the UnpackProductFiles function for another user on the machine where the tool has run before or once the registry key has been set.
"""This example is for running the tool for a second user on a machine where this tool has already been run, or when running this tool when the registry key has already been set"""
# Importing necessary modules
from _winreg import OpenKeyEx, HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER, QueryValueEx, CloseKey
from arcpy import defense, GetInstallInfo
from os import path
# Getting value for the currently set registry key; if there is none for this user, get the install path key
install_info = GetInstallInfo()
if install_info['ProductName'] == 'Desktop':
product_key = 'SOFTWARE\\EsriProduction\\Desktop{}\\ESRIDefenseMapping\\Settings'.format(install_info['Version'][:4])
install_key = 'Software\\ESRIProduction\\Desktop{}\\ESRIDefenseMapping'.format(install_info['Version'][:4])
elif install_info['ProductName'] == 'Server':
product_key = 'SOFTWARE\\EsriProduction\\Server{}\\ESRIDefenseMapping\\Settings'.format(install_info['Version'][:4])
install_key = 'Software\\EsriProduction\\Server{}\\EsriDefenseMapping'.format(install_info['Version'][:4])
try:
hkey = OpenKeyEx(HKEY_CURRENT_USER, product_key)
registry_value, typ = QueryValueEx(hkey, 'ProductFilePath')
except:
hkey = OpenKeyEx(HKEY_LOCAL_MACHINE, install_key)
registry_value, typ = QueryValueEx(hkey, 'InstallDir')
CloseKey(hkey)
# Setting parameters
current_folder = path.abspath(registry_value)
new_folder = r'C:\Data\ProductFiles'
products ="Geonames;Mgcp;ReferenceData;Tds;VMap1JOG"
# Calling Unpack Product Files tool
defense.UnpackProductFiles(current_folder, "UPDATE_PATH_ONLY", new_folder, products)
Параметры среды
Информация о лицензиях
- Basic: Нет
- Standard: Требуется Defense Mapping
- Advanced: Требуется Defense Mapping