摘要
Esri Defense Mapping tool that copies and extracts selected product files to the path provided by the user. It also sets a registry key to the provided path to be used by any of the Defense Mapping tools in obtaining paths to the product files.
用法
This tool is intended for users who have limited, non-administrative privileges to the Defense Mapping installation folder. Unpacking the Defense Mapping product files to a folder that the user has read/write access privileges to allows them to use Defense Mapping tools that require access to the installed product files.
This tool should be run after installing Defense Mapping and before running any of the Defense Mapping tools.
If a custom location is not used, this tool should be run with C:\Program Files (x86)\ArcGIS\EsriDefenseMapping\10.3.1 as the New Location path.
This tool sets a user registry key value that is only for the current user; if there are multiple users on a single machine, this tool should be run 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, the tool should be run using the UPDATE_PATH_ONLY option 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 using the UPDATE_PATH_ONLY option.
If running this tool on a server, it must be run as the arcgis user in addition to any named users.
语法
UnpackProductFiles_defense (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, this defaults to the installation directory. | String |
in_copy_products | Determines if this tool will copy product files to a new location or only update the registry key.
| Boolean |
in_new_folder | Path to folder that will be used as the product files directory. This path is written to the registry key. | Folder |
in_products (可选) | Selection of products to copy and extract to the location set in the in_new_folder parameter. | String |
代码示例
UnpackProductFiles example 1 (Python window)
The following code sample demonstrates running the tool 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 tool for another user on the machine where the tool has run before, or how to run this tool 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)
环境
许可信息
- ArcGIS Desktop Basic: 否
- ArcGIS Desktop Standard: 需要 Defense Mapping
- ArcGIS Desktop Advanced: 需要 Defense Mapping