当前位置: 首页>>代码示例>>Python>>正文


Python arcpy.GetParameter方法代码示例

本文整理汇总了Python中arcpy.GetParameter方法的典型用法代码示例。如果您正苦于以下问题:Python arcpy.GetParameter方法的具体用法?Python arcpy.GetParameter怎么用?Python arcpy.GetParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在arcpy的用法示例。


在下文中一共展示了arcpy.GetParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: import arcpy [as 别名]
# 或者: from arcpy import GetParameter [as 别名]
def main():
    arcrestZip = 'arcrest.zip'
    arcrestHelperZip = 'arcresthelper.zip'

    get_latest = arcpy.GetParameter(0)
    installInBoth = arcpy.GetParameter(1)
    base_folder = os.path.dirname(__file__)
    #arcpy.AddMessage("%s: " % base_folder)
    base_folder = os.path.dirname(base_folder)
    #arcpy.AddMessage("%s: " % base_folder)
    base_folder = os.path.dirname(base_folder)
    #arcpy.AddMessage("%s: " % base_folder)
    base_file = os.path.splitext(os.path.basename(__file__))[0]

    if get_latest:
        arcrest_zip, arcresthelper_zip = download_arcrest()
    else:
        commondata = os.path.join(base_folder, "commondata")
        if os.path.isdir(os.path.join(commondata, base_file)):
            arcrest_zip = os.path.join(commondata,base_file, arcrestZip)
            arcresthelper_zip = os.path.join(commondata, base_file, arcrestHelperZip)
        elif os.path.isdir(os.path.join(commondata, "userdata")):
            arcrest_zip = os.path.join(commondata, "userdata", arcrestZip)
            arcresthelper_zip = os.path.join(commondata,  "userdata", arcrestHelperZip)

    site_package = None
    site_package64 = None
    defPath =  os.path.dirname(os.__file__)
    if ('ArcGIS' in defPath):
        if ('x64' in defPath):
            site_package = os.path.join(defPath.replace('x64',''), 'site-packages')
            site_package64 = os.path.join(defPath, 'site-packages')
        else:
            site_package = os.path.join(defPath, 'site-packages')
            site_package64 = os.path.join(defPath.replace('ArcGIS','ArcGISx64'), 'site-packages')
    else:
        site_package = os.path.join(defPath,'site-packages')
##    for p in sys.path:
##        if p.lower().find("site-packages") > -1:
##            site_package = p
##            break
##        del p
    if site_package is None:
        raise arcpy.ExecuteError("Could not find the site-package folder")
    installPackages(arcrest_zip,arcresthelper_zip, site_package)

    if site_package64 is not None and installInBoth == True:
        arcpy.AddMessage(" ")
        arcpy.AddMessage("-----------------------------------------------")
        arcpy.AddMessage(" ")
        installPackages(arcrest_zip,arcresthelper_zip, site_package64)
    arcpy.AddMessage(" ")
    arcpy.AddMessage("... Process Complete ...".format(site_package)) 
开发者ID:Esri,项目名称:ArcREST,代码行数:55,代码来源:install_arcrest.py


注:本文中的arcpy.GetParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。