當前位置: 首頁>>代碼示例>>Python>>正文


Python GTFSDatabase.service_ids方法代碼示例

本文整理匯總了Python中graphserver.ext.gtfs.gtfsdb.GTFSDatabase.service_ids方法的典型用法代碼示例。如果您正苦於以下問題:Python GTFSDatabase.service_ids方法的具體用法?Python GTFSDatabase.service_ids怎麽用?Python GTFSDatabase.service_ids使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在graphserver.ext.gtfs.gtfsdb.GTFSDatabase的用法示例。


在下文中一共展示了GTFSDatabase.service_ids方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: process_transit_graph

# 需要導入模塊: from graphserver.ext.gtfs.gtfsdb import GTFSDatabase [as 別名]
# 或者: from graphserver.ext.gtfs.gtfsdb.GTFSDatabase import service_ids [as 別名]
def process_transit_graph(graphdb_filename, gtfsdb_filenames, osmdb_filename=None, profiledb_filename=None, agency_id=None, link_stations=False, slogs={}):
    g = Graph()

    if profiledb_filename:
        print( "Opening ProfileDB '%s'"%profiledb_filename )
        profiledb = ProfileDB( profiledb_filename )
    else:
        print( "No ProfileDB supplied" )
        profiledb = None

    if osmdb_filename:
        # Load osmdb ===============================
        print( "Opening OSM-DB '%s'"%osmdb_filename )
        osmdb = OSMDB( osmdb_filename )
        compiler.load_streets_to_graph( g, osmdb, profiledb, slogs, reporter=sys.stdout )
    
    # Load gtfsdb ==============================
   
    for i, gtfsdb_filename in enumerate(gtfsdb_filenames): 
        gtfsdb = GTFSDatabase( gtfsdb_filename )
        service_ids = [x.encode("ascii") for x in gtfsdb.service_ids()]
        compiler.load_gtfsdb_to_boardalight_graph(g, str(i), gtfsdb, agency_id=agency_id, service_ids=service_ids)
        if osmdb_filename:
            compiler.load_transit_street_links_to_graph( g, osmdb, gtfsdb, reporter=sys.stdout )
        
        if link_stations:
            compiler.link_nearby_stops( g, gtfsdb )

    # Export to graphdb ========================
    
    graphdb = GraphDatabase( graphdb_filename, overwrite=True )
    graphdb.populate( g, reporter=sys.stdout )
開發者ID:dru,項目名稱:graphserver,代碼行數:34,代碼來源:compile_graph.py

示例2: process_transit_graph

# 需要導入模塊: from graphserver.ext.gtfs.gtfsdb import GTFSDatabase [as 別名]
# 或者: from graphserver.ext.gtfs.gtfsdb.GTFSDatabase import service_ids [as 別名]
def process_transit_graph(gtfsdb_filename, agency_id, graphdb_filename, link=False):
    gtfsdb = GTFSDatabase( gtfsdb_filename )
    
    g = Graph()
    service_ids = [x.encode("ascii") for x in gtfsdb.service_ids()]
    compiler.load_gtfsdb_to_boardalight_graph(g, gtfsdb, agency_id=agency_id, service_ids=service_ids)
    
    if link:
        compiler.link_nearby_stops( g, gtfsdb )
    
    graphdb = GraphDatabase( graphdb_filename, overwrite=True )
    graphdb.populate( g, reporter=sys.stdout )
開發者ID:spike,項目名稱:graphserver,代碼行數:14,代碼來源:compile_graph.py

示例3: process_transit_street_graph

# 需要導入模塊: from graphserver.ext.gtfs.gtfsdb import GTFSDatabase [as 別名]
# 或者: from graphserver.ext.gtfs.gtfsdb.GTFSDatabase import service_ids [as 別名]
def process_transit_street_graph(graphdb_filename, gtfsdb_filename, osmdb_filename, agency_id=None):
    g = Graph()

    # Load osmdb ===============================
    
    print( "Opening OSM-DB '%s'"%osmdb_filename )
    osmdb = OSMDB( osmdb_filename )
    compiler.load_streets_to_graph( g, osmdb, sys.stdout )
    
    # Load gtfsdb ==============================
   
    for i, gtfsdb_filename in enumerate(gtfsdb_filenames): 
        gtfsdb = GTFSDatabase( gtfsdb_filename )
        service_ids = [x.encode("ascii") for x in gtfsdb.service_ids()]
        compiler.load_gtfsdb_to_boardalight_graph(g, str(i), gtfsdb, agency_id=agency_id, service_ids=service_ids)
        compiler.load_transit_street_links_to_graph( g, osmdb, gtfsdb, reporter=sys.stdout )
    
    # Export to graphdb ========================
    
    graphdb = GraphDatabase( graphdb_filename, overwrite=True )
    graphdb.populate( g, reporter=sys.stdout )
開發者ID:spike,項目名稱:graphserver,代碼行數:23,代碼來源:compile_graph.py


注:本文中的graphserver.ext.gtfs.gtfsdb.GTFSDatabase.service_ids方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。