Пример #1
0
def get_options(args=None):
    argParser = gtfs2fcd.add_options()
    argParser.add_argument("--mapperlib",
                           default="lib/fcd-process-chain-2.2.2.jar",
                           help="mapping library to use")
    argParser.add_argument(
        "--map-output",
        help="directory to write the generated mapping files to")
    argParser.add_argument(
        "--map-output-config",
        default="conf/output_configuration_template.xml",
        help="output configuration template for the mapper library")
    argParser.add_argument(
        "--map-input-config",
        default="conf/input_configuration_template.xml",
        help="input configuration template for the mapper library")
    argParser.add_argument("--map-parameter",
                           default="conf/parameters_template.xml",
                           help="parameter template for the mapper library")
    argParser.add_argument("--poly-output",
                           help="file to write the generated polygon files to")
    argParser.add_argument(
        "--route-output",
        help="file to write the generated public transport stops and routes to"
    )
    argParser.add_argument(
        "--vehicle-output",
        help="file to write the generated public transport vehicles to")
    argParser.add_argument("-n", "--network", help="sumo network to use")
    argParser.add_argument("--network-split",
                           help="directory to write generated networks to")
    argParser.add_argument("-b",
                           "--begin",
                           default=0,
                           type=int,
                           help="Defines the begin time to export")
    argParser.add_argument("-e",
                           "--end",
                           default=86400,
                           type=int,
                           help="Defines the end time for the export")
    argParser.add_argument("--skip-fcd",
                           action="store_true",
                           default=False,
                           help="skip generating fcd data")
    argParser.add_argument("--skip-map",
                           action="store_true",
                           default=False,
                           help="skip network mapping")

    options = gtfs2fcd.check_options(argParser.parse_args(args=args))
    if options.map_output is None:
        options.map_output = os.path.join('output', options.region)
    if options.network_split is None:
        options.network_split = os.path.join('resources', options.region)
    if options.route_output is None:
        options.route_output = options.region + "_publictransport.add.xml"
    if options.vehicle_output is None:
        options.vehicle_output = options.region + "_publictransport.rou.xml"
    return options
Пример #2
0
def get_options(args=None):
    argParser = gtfs2fcd.add_options()
    argParser.add_argument("--mapperlib", default="lib/fcd-process-chain-2.2.2.jar",
                           help="mapping library to use")
    argParser.add_argument("--map-output", help="directory to write the generated mapping files to")
    argParser.add_argument("--map-output-config", default="conf/output_configuration_template.xml",
                           help="output configuration template for the mapper library")
    argParser.add_argument("--map-input-config", default="conf/input_configuration_template.xml",
                           help="input configuration template for the mapper library")
    argParser.add_argument("--map-parameter", default="conf/parameters_template.xml",
                           help="parameter template for the mapper library")
    argParser.add_argument("--poly-output", help="file to write the generated polygon files to")
    argParser.add_argument("--route-output", help="file to write the generated public transport stops and routes to")
    argParser.add_argument("--vehicle-output", help="file to write the generated public transport vehicles to")
    argParser.add_argument("-n", "--network", help="sumo network to use", fix_path=True)
    argParser.add_argument("--network-split", help="directory to write generated networks to")
    # argParser.add_argument("--network-split.vclass", action="store_true", default=False,
    #                        help="use the allowed vclass instead of the edge type to split the network")
    argParser.add_argument("-b", "--begin", default=0,
                           type=int, help="Defines the begin time to export")
    argParser.add_argument("-e", "--end", default=86400,
                           type=int, help="Defines the end time for the export")
    argParser.add_argument("--duration", default=10,
                           type=int, help="minimum time to wait on a stop")
    argParser.add_argument("--skip-fcd", action="store_true", default=False, help="skip generating fcd data")
    argParser.add_argument("--skip-map", action="store_true", default=False, help="skip network mapping")
    argParser.add_argument("--warn-unmapped", action="store_true", default=False, help="warn about unmapped routes")
    argParser.add_argument("--bus-stop-length", default=13, type=float, help="length for a bus stop")
    argParser.add_argument("--train-stop-length", default=110, type=float, help="length for a train stop")
    argParser.add_argument("--tram-stop-length", default=60, type=float, help="length for a tram stop")
    argParser.add_argument("--fill-gaps", default=5000, type=float, help="maximum distance between stops")

    options = gtfs2fcd.check_options(argParser.parse_args(args=args))
    if options.network is None:
        sys.exit("Please give a network file using --network FILE.")
    if options.map_output is None:
        options.map_output = os.path.join('output', options.region)
    if options.network_split is None:
        options.network_split = os.path.join('resources', options.region)
    if options.route_output is None:
        options.route_output = options.region + "_publictransport.add.xml"
    if options.vehicle_output is None:
        options.vehicle_output = options.region + "_publictransport.rou.xml"
    return options
Пример #3
0
def get_options(args=None):
    ap = sumolib.options.ArgumentParser()
    ap = gtfs2fcd.add_options()
    # ----------------------- general options ---------------------------------
    ap.add_argument("-n",
                    "--network",
                    fix_path=True,
                    help="sumo network to use")
    ap.add_argument(
        "--route-output",
        help="file to write the generated public transport vehicles to"
    )  # noqa
    ap.add_argument(
        "--additional-output",
        help="file to write the generated public transport stops and routes to"
    )  # noqa
    ap.add_argument("--duration",
                    default=10,
                    type=int,
                    help="minimum time to wait on a stop")
    ap.add_argument("--bus-stop-length",
                    default=13,
                    type=float,
                    help="length for a bus stop")
    ap.add_argument("--train-stop-length",
                    default=110,
                    type=float,
                    help="length for a train stop")
    ap.add_argument("--tram-stop-length",
                    default=60,
                    type=float,
                    help="length for a tram stop")

    # ----------------------- fcd options -------------------------------------
    ap.add_argument("--network-split",
                    help="directory to write generated networks to")
    # ap.add_argument("--network-split.vclass", action="store_true", default=False,
    #                        help="use the allowed vclass instead of the edge type to split the network")
    ap.add_argument("--warn-unmapped",
                    action="store_true",
                    default=False,
                    help="warn about unmapped routes")
    ap.add_argument("--mapperlib",
                    default="lib/fcd-process-chain-2.2.2.jar",
                    help="mapping library to use")
    ap.add_argument(
        "--map-output",
        help="directory to write the generated mapping files to")  # noqa
    ap.add_argument(
        "--map-output-config",
        default="conf/output_configuration_template.xml",  # noqa
        help="output configuration template for the mapper library")  # noqa
    ap.add_argument(
        "--map-input-config",
        default="conf/input_configuration_template.xml",  # noqa
        help="input configuration template for the mapper library")
    ap.add_argument("--map-parameter",
                    default="conf/parameters_template.xml",
                    help="parameter template for the mapper library")
    ap.add_argument(
        "--poly-output",
        help="file to write the generated polygon files to")  # noqa
    ap.add_argument("--fill-gaps",
                    default=5000,
                    type=float,
                    help="maximum distance between stops")
    ap.add_argument("--skip-fcd",
                    action="store_true",
                    default=False,
                    help="skip generating fcd data")
    ap.add_argument("--skip-map",
                    action="store_true",
                    default=False,
                    help="skip network mapping")

    # ----------------------- osm options -------------------------------------
    ap.add_argument("--osm-routes", help="osm routes file")
    ap.add_argument("--warning-output",
                    help="file to write the unmapped elements from gtfs")
    ap.add_argument("--dua-repair-output",
                    help="file to write the osm routes with errors")
    ap.add_argument(
        "--bbox",
        help="define the bounding box to filter the gtfs data, format: W,S,E,N"
    )  # noqa
    ap.add_argument("--repair", help="repair osm routes", action='store_true')
    ap.add_argument(
        "--min-stops",
        default=3,
        type=int,
        help=
        "minimum number of stops a public transport line must have to be imported"
    )  # noqa

    options = ap.parse_args(args)

    options = gtfs2fcd.check_options(options)

    if options.network is None:
        sys.exit("Please give a network file using --network FILE.")
    if options.additional_output is None:
        options.additional_output = options.region + "_publictransport.add.xml"
    if options.route_output is None:
        options.route_output = options.region + "_publictransport.rou.xml"
    if options.warning_output is None:
        options.warning_output = options.region + "_missing.xml"
    if options.dua_repair_output is None:
        options.dua_repair_output = options.region + "_repair_errors.txt"

    if not options.osm_routes:
        if options.map_output is None:
            options.map_output = os.path.join('output', options.region)
        if options.network_split is None:
            options.network_split = os.path.join('resources', options.region)

    return options