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


Python Search.parseOptions方法代码示例

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


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

示例1: countyMapperMenu

# 需要导入模块: import Search [as 别名]
# 或者: from Search import parseOptions [as 别名]
def countyMapperMenu(caches):
    #Filters caches given by BC, then tries to assign them to a regional district of BC.
    
    #Menu to choose province
    print "Will search BC Caches and try to assign counties"
    
    #get caches in BC currently without a county
    (options, args, search) = Search.parse('-s "British Columbia" -O C', False)
    cacheList = Search.parseOptions(caches, options)
    
    #write these caches to a file
    filename = writeCountyMapper(cacheList)
    
    BCPolygons = ['BC/Alberni-Clayoquot.arc', 'BC/Bulkley-Nechako.arc', 'BC/Capital.arc',
                'BC/Cariboo.arc', 'BC/Central Coast.arc', 'BC/Central Kootenay.arc', 
                'BC/Central Okanagan.arc', 'BC/Columbia-Shuswap.arc', 'BC/Comox Valley.arc', 
                'BC/Cowichan Valley.arc', 'BC/East Kootenay.arc', 'BC/Fraser Valley.arc', 
                'BC/Fraser-Fort George.arc', 'BC/Greater Vancouver.arc', 'BC/Kitimat-Stikine.arc',
                'BC/Kootenay Boundary.arc',  'BC/Mount Waddington.arc', 'BC/Nanaimo.arc', 
                'BC/North Okanagan.arc', 'BC/Northern Rockies.arc', 'BC/Okanagan-Similkameen.arc',
                'BC/Peace River.arc', 'BC/Powell River.arc', 'BC/Skeena-Queen Charlotte.arc',
                'BC/Squamish-Lillooet.arc', 'BC/Stikine.arc', 'BC/Strathcona.arc', 
                'BC/Sunshine Coast.arc', 'BC/Thompson-Nicola.arc']
    #call GPSBabel to filter these caches through each polygon, then remove temp files
    gcids = {}
    for polygonName in BCPolygons:
        callPolygonFilter(filename, polygonName, "test.out")
        gcids.update(readCountyMapper(os.path.join(os.getcwd(), 'test.out'), polygonName[3:-4]))
        os.remove("test.out")
        if len(gcids) > 0:
            log.info("%s has caches" %(polygonName[3:]))
        else:
            log.info("%s does not have caches" %(polygonName[3:]))
    os.remove(filename)
    
    #save county name to caches
    for cache in cacheList:
        if cache.gcid in gcids.keys():
            cache.county = gcids[cache.gcid]
        else:
            log.error("%s was not found in a BC Regional District despite being in BC" %cache.gcid)
    return
开发者ID:alarobric,项目名称:geocachepython,代码行数:44,代码来源:countyMapper.py


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