本文整理汇总了Python中arcpy.GetInstallInfo方法的典型用法代码示例。如果您正苦于以下问题:Python arcpy.GetInstallInfo方法的具体用法?Python arcpy.GetInstallInfo怎么用?Python arcpy.GetInstallInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arcpy
的用法示例。
在下文中一共展示了arcpy.GetInstallInfo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_Arc_version
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import GetInstallInfo [as 别名]
def check_Arc_version(useAGOL=False, useNA=False):
'''Check that the user has a version of ArcGIS that can support this tool.'''
ArcVersionInfo = arcpy.GetInstallInfo("desktop")
ArcVersion = ArcVersionInfo['Version']
global ProductName
ProductName = ArcVersionInfo['ProductName']
global useBearing
if ProductName == "ArcGISPro":
if ArcVersion in ["1.0", "1.1", "1.1.1"]:
arcpy.AddError("You must have ArcGIS Pro 1.2 or higher to run this \
tool. You have ArcGIS Pro version %s." % ArcVersion)
raise CustomError
if useNA and ArcVersion in ["1.0", "1.0.1", "1.0.2", "1.1", "1.1.1", "1.2", "1.3", "1.3.1", "1.4", "1.4.1"]:
# Bearing and BearingTol fields did not work until Pro 2.0.
arcpy.AddWarning("Warning! Certain functionality was implemented in ArcGIS Pro 2.0 that \
significantly improves the output of this tool. For better results, upgrade to the latest version of ArcGIS Pro or run \
this tool with ArcMap version 10.3 or higher.")
useBearing = False
else:
if ArcVersion == "10.0":
arcpy.AddError("You must have ArcGIS 10.2.1 or higher (or ArcGIS Pro) to run this \
tool. You have ArcGIS version %s." % ArcVersion)
raise CustomError
if ArcVersion in ["10.1", "10.2"]:
arcpy.AddWarning("Warning! You can run Step 1 of this tool in \
ArcGIS 10.1 or 10.2, but you will not be able to run Step 2 without ArcGIS \
10.2.1 or higher (or ArcGIS Pro). You have ArcGIS version %s." % ArcVersion)
if useNA:
useBearing = False
if useAGOL and ArcVersion in ["10.2.1", "10.2.2"]:
arcpy.AddError("You must have ArcGIS 10.3 (or ArcGIS Pro) to run the ArcGIS Online \
version of this tool. You have ArcGIS version %s." % ArcVersion)
raise CustomError
if useNA and ArcVersion in ["10.2.1", "10.2.2"]:
arcpy.AddWarning("Warning! This version of Step 1 will produce significantly \
better output using ArcGIS version 10.3 or higher or ArcGIS Pro 2.0 or higher. You have ArcGIS version %s." % ArcVersion)
useBearing = False
示例2: DetermineArcVersion
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import GetInstallInfo [as 别名]
def DetermineArcVersion():
'''Figure out what version of ArcGIS the user is running'''
ArcVersionInfo = arcpy.GetInstallInfo("desktop")
global ArcVersion, ProductName
ProductName = ArcVersionInfo['ProductName']
ArcVersion = ArcVersionInfo['Version']
示例3: getDesktopFolder
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import GetInstallInfo [as 别名]
def getDesktopFolder():
# Get install info
install_info = arcpy.GetInstallInfo()
# Get Version
version = install_info["Version"]
folder_version = version.split(".")[0] + "." + version.split(".")[1]
# Create desktop folder path
desktop_fldr = os.path.join(os.path.dirname(os.path.dirname(install_info["InstallDir"])), "MaritimeCharting", "Desktop" + folder_version)
return desktop_fldr
示例4: arcgis_platform
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import GetInstallInfo [as 别名]
def arcgis_platform():
""" ArcGIS platform details used internally."""
info = arcpy.GetInstallInfo()
install_dir = info['InstallDir']
arc_version = info['Version']
if info['ProductName'] == 'ArcGISPro':
product = 'Pro'
else:
# there are other levels, but this is a PYT run from toolbox,
# so unlikely to be a non-ArcMap context
product = 'ArcMap'
return (install_dir, arc_version, product)
示例5: r_pkg_path
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import GetInstallInfo [as 别名]
def r_pkg_path():
"""
Package path search. Locations searched:
- HKCU\\Software\\Esri\\ArcGISPro\\RintegrationProPackagePath
- [MYDOCUMENTS]/R/win-library/[3-9].[0-9]/ - default for user R packages
- [ArcGIS]/Resources/Rintegration/arcgisbinding
"""
package_path = None
package_name = 'arcgisbinding'
root_key = winreg.HKEY_CURRENT_USER
reg_path = "SOFTWARE\\Esri\\ArcGISPro"
package_key = 'RintegrationProPackagePath'
pro_reg = None
try:
# find the key, 64- or 32-bit we want it all
pro_reg = winreg.OpenKey(root_key, reg_path, 0, READ_ACCESS)
except fnf_exception as error:
handle_fnf(error)
if pro_reg:
try:
# returns a tuple of (value, type)
package_path_key = winreg.QueryValueEx(pro_reg, package_key)
package_path_raw = package_path_key[0]
if os.path.exists(package_path_raw):
package_path = package_path_raw
except fnf_exception as error:
handle_fnf(error)
# iterate over all known library path locations,
# and check for our package in each.
for lib_path in r_all_lib_paths():
possible_package_path = os.path.join(lib_path, package_name)
if os.path.exists(possible_package_path):
package_path = possible_package_path
# we want the highest-priority library, stop here
break
# fallback -- <ArcGIS Install>/Rintegration/arcgisbinding
if not package_path:
import arcpy
arc_install_dir = arcpy.GetInstallInfo()['InstallDir']
arc_package_dir = os.path.join(
arc_install_dir, 'Rintegration', package_name)
if os.path.exists(arc_package_dir):
package_path = arc_package_dir
return package_path
示例6: concatenate_fields
# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import GetInstallInfo [as 别名]
def concatenate_fields(table, new_field, length, fields=[], delimiter='', number_only=False):
"""Create a new field in a table and concatenate user defined fields.
This can be used in situations such as creating a Section-Township-Range
field from 3 different fields.
Returns the field name that was added.
Required:
table -- Input table
new_field -- new field name
length -- field length
fields -- list of fields to concatenate
Optional:
delimiter -- join value for concatenated fields
(example: '-' , all fields will be delimited by dash)
number_only -- if True, only numeric values from a text field are extracted.
Default is False.
Example:
>>> sec = r'C:\Temp\Sections.shp'
>>> concatenate_fields(sec, 'SEC_TWP_RNG', 15, ['SECTION', 'TOWNSHIP', 'RANGE'], '-')
"""
# Add field
new_field = create_field_name(table, new_field)
arcpy.AddField_management(table, new_field, 'TEXT', field_length=length)
# Concatenate fields
if arcpy.GetInstallInfo()['Version'] != '10.0':
# da cursor
with arcpy.da.UpdateCursor(table, fields + [new_field]) as rows:
for r in rows:
r[-1] = concatenate(r[:-1], delimiter, number_only)
rows.updateRow(r)
else:
# 10.0 cursor
rows = arcpy.UpdateCursor(table)
for r in rows:
r.setValue(new_field, concatenate([r.getValue(f) for f in fields], delimiter, number_only))
rows.updateRow(r)
del r, rows
return new_field