コード例 #1
0
def main(argv):
    # Initialize from command-line parameters:
    if len(argv) < 7:
        syntax()
    dbServer = argv[1]
    networkName = argv[2]
    userName = argv[3]
    password = argv[4]
    shapePath = argv[5]
    pathMatchFilename = argv[6]
    hintFilename = None
    routeRestrictFilename = None
    if len(argv) > 6:
        i = 7
        while i < len(argv):
            if argv[i] == "-h" and i < len(argv) - 1:
                hintFilename = argv[i + 1]
                i += 1
            elif argv[i] == "-r" and i < len(argv) - 1:
                routeRestrictFilename = argv[i + 1]
                i += 1
            i += 1
    
    # Restore the stuff that was built with path_match:
    (vistaGraph, gtfsShapes, gtfsNodes, unusedShapeIDs) = transit_gtfs.restorePathMatch(dbServer, networkName,
        userName, password, shapePath, pathMatchFilename)
    # TODO: We don't do anything with unusedShapeIDs right now.
    
    # Restore the hint file if it is specified:
    if hintFilename is not None:
        print("INFO: Read hint file...", file = sys.stderr)
    else:
        print("INFO: No hint file was specified.", file = sys.stderr)
    hintEntries = fillHints(hintFilename, shapePath, gtfsShapes, vistaGraph.gps, unusedShapeIDs)
    "@type hintEntries: dict<int, path_engine.ShapesEntry>"

    # Filter down the routes that we're interested in:
    if routeRestrictFilename is not None:
        gtfsNodes = filterRoutes(gtfsNodes, shapePath, gtfsShapes, routeRestrictFilename)

    print("INFO: Refining paths.", file = sys.stderr)
    gtfsNodesResults = pathsRefine(gtfsNodes, hintEntries, vistaGraph)
    "@type gtfsNodesResults: dict<int, list<path_engine.PathEnd>>"
    
    print("INFO: -- Final --", file = sys.stderr)
    print("INFO: Print output...", file = sys.stderr)
    path_engine.dumpStandardHeader()

    shapeIDs = gtfsNodesResults.keys()
    "@type shapeIDs: list<int>"
    shapeIDs.sort()
    for shapeID in shapeIDs:
        "@type shapeID: int"
        path_engine.dumpStandardInfo(gtfsNodesResults[shapeID])
        
    print("INFO: Done.", file = sys.stderr)
コード例 #2
0
ファイル: path_match.py プロジェクト: LabNAYO/nmc-map-matcher
def main(argv):
    # Initialize from command-line parameters:
    if len(argv) < 6:
        syntax()
    dbServer = argv[1]
    networkName = argv[2]
    userName = argv[3]
    password = argv[4]
    shapePath = argv[5]
    
    gtfsNodesResults = pathMatch(dbServer, networkName, userName, password, shapePath)
    
    # Extract useful information:
    print("INFO: -- Final --", file = sys.stderr)
    print("INFO: Print output...", file = sys.stderr)
    path_engine.dumpStandardHeader()

    shapeIDs = gtfsNodesResults.keys()
    "@type shapeIDs: list<int>"
    shapeIDs.sort()
    for shapeID in shapeIDs:
        "@type shapeID: int"
        path_engine.dumpStandardInfo(gtfsNodesResults[shapeID])
コード例 #3
0
def main(argv):
    # Initialize from command-line parameters:
    if len(argv) < 6:
        syntax()
    dbServer = argv[1]
    networkName = argv[2]
    userName = argv[3]
    password = argv[4]
    filename = argv[5]
    
    gtfsNodesResults = pathMatch(dbServer, networkName, userName, password, filename)
    
    # Extract useful information:
    print("INFO: -- Final --", file = sys.stderr)
    print("INFO: Print output...", file = sys.stderr)
    path_engine.dumpStandardHeader()

    datafileIDs = compat.listkeys(gtfsNodesResults)
    "@type datafileIDs: list<str>"
    datafileIDs.sort()
    for datafileID in datafileIDs:
        "@type datafileID: str"
        path_engine.dumpStandardInfo(gtfsNodesResults[datafileID])
コード例 #4
0
def main(argv):
    # Initialize from command-line parameters:
    if len(argv) < 7:
        syntax()
    dbServer = argv[1]
    networkName = argv[2]
    userName = argv[3]
    password = argv[4]
    shapePath = argv[5]
    pathMatchFilename = argv[6]
    hintFilename = None
    routeRestrictFilename = None
    if len(argv) > 6:
        i = 7
        while i < len(argv):
            if argv[i] == "-h" and i < len(argv) - 1:
                hintFilename = argv[i + 1]
                i += 1
            elif argv[i] == "-r" and i < len(argv) - 1:
                routeRestrictFilename = argv[i + 1]
                i += 1
            i += 1

    # Restore the stuff that was built with path_match:
    (vistaGraph, gtfsShapes, gtfsNodes,
     unusedShapeIDs) = transit_gtfs.restorePathMatch(dbServer, networkName,
                                                     userName, password,
                                                     shapePath,
                                                     pathMatchFilename)
    # TODO: We don't do anything with unusedShapeIDs right now.

    # Restore the hint file if it is specified:
    if hintFilename is not None:
        print("INFO: Read hint file...", file=sys.stderr)
    else:
        print("INFO: No hint file was specified.", file=sys.stderr)
    hintEntries = fillHints(hintFilename, shapePath, gtfsShapes,
                            vistaGraph.gps, unusedShapeIDs)
    "@type hintEntries: dict<int, path_engine.ShapesEntry>"

    # Filter down the routes that we're interested in:
    if routeRestrictFilename is not None:
        gtfsNodes = filterRoutes(gtfsNodes, shapePath, gtfsShapes,
                                 routeRestrictFilename)

    print("INFO: Refining paths.", file=sys.stderr)
    gtfsNodesResults = pathsRefine(gtfsNodes, hintEntries, vistaGraph)
    "@type gtfsNodesResults: dict<int, list<path_engine.PathEnd>>"

    print("INFO: -- Final --", file=sys.stderr)
    print("INFO: Print output...", file=sys.stderr)
    path_engine.dumpStandardHeader()

    shapeIDs = compat.listkeys(gtfsNodesResults)
    "@type shapeIDs: list<int>"
    shapeIDs.sort()
    for shapeID in shapeIDs:
        "@type shapeID: int"
        path_engine.dumpStandardInfo(gtfsNodesResults[shapeID])

    print("INFO: Done.", file=sys.stderr)