def main(argv): # Initialize from command-line parameters: parser = argparse.ArgumentParser( description= "problem_report outputs GPS information for GTFS shapefiles, reporting " + "potential problems with VISTA path matching. Problem codes: 0: OK; 1: Path restarted; 2: For perpendicular; " + "3: For nonperpendicular; 4: Intermediate link") parser.add_argument( "dbServer", help="PostgreSQL database server on which this is to run") parser.add_argument("networkName", help="Network name for the underlying topology") parser.add_argument("userName", help="Username for the database") parser.add_argument("password", help="Password for the database") parser.add_argument("shapePath", help="Path to GTFS files") parser.add_argument( "pathMatchFile", help= "Path match file that was previously outputted by path_match.py or others" ) parser.add_argument("-L", "--interLinks", action="store_true", help="Outputs intermediate links and positions") args = parser.parse_args() # Restore the stuff that was built with path_match: (vistaGraph, gtfsShapes, gtfsNodes, unusedShapeIDs) = transit_gtfs.restorePathMatch( args.dbServer, args.networkName, args.userName, args.password, args.shapePath, args.pathMatchFile) print("INFO: Output CSV...", file=sys.stderr) problemReport(gtfsNodes, vistaGraph, showLinks=args.interLinks) print("INFO: Done.", file=sys.stderr)
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)
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] # Restore the stuff that was built with path_match: (vistaGraph, gtfsShapes, gtfsNodes, unusedShapeIDs) = transit_gtfs.restorePathMatch(dbServer, networkName, userName, password, shapePath, pathMatchFilename) print("INFO: Output CSV...", file = sys.stderr) problemReport(gtfsNodes, vistaGraph) print("INFO: Done.", file = sys.stderr)
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] # Restore the stuff that was built with path_match: (vistaGraph, gtfsShapes, gtfsNodes, unusedShapeIDs) = transit_gtfs.restorePathMatch(dbServer, networkName, userName, password, shapePath, pathMatchFilename) print("INFO: Output CSV...", file=sys.stderr) dumpGPS(gtfsNodes, vistaGraph) print("INFO: Done.", file=sys.stderr)
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)