コード例 #1
0
ファイル: traceExporter.py プロジェクト: titkos-bit/sumo
def main(args=None):
    """The main function; parses options and converts..."""
    # ---------- build and read options ----------
    USAGE = """Usage %prog -i <FCDDATA> [options]
Converts the given fcd file (generated by sumo --fcd-output) into the selected
output format. Optionally the output can be sampled, filtered and distorted.
"""

    from optparse import OptionParser
    optParser = OptionParser(usage=USAGE)
    optParser.add_option("-i", "--fcd-input", dest="fcd", metavar="FILE",
                         help="Defines the FCD-output file to use as input " +
                              "(numeric value is interpreted as port to listen on)")
    optParser.add_option("-n", "--net-input", dest="net", metavar="FILE",
                         help="Defines the network file to use as input")
    optParser.add_option("-p", "--penetration", type="float", dest="penetration",
                         default=1., help="Defines the percentage (0-1) of vehicles to export")
    optParser.add_option("-b", "--begin", dest="begin",
                         type="float", help="Defines the first step to export")
    optParser.add_option("-e", "--end", dest="end",
                         type="float", help="Defines the first step not longer to export")
    optParser.add_option("-d", "--delta-t", dest="delta",
                         type="float", help="Defines the export step length")
    optParser.add_option("--gps-blur", dest="blur", default=0,
                         type="float", help="Defines the GPS blur")
    optParser.add_option(
        "--boundary", help="Defines the bounding box as 'xmin,ymin,xmax,ymax'")
    optParser.add_option("-s", "--seed", dest="seed", default=42,
                         type="float", help="Defines the randomizer seed")
    optParser.add_option(
        "--base-date", dest="base", default=-1, type="int", help="Defines the base date")
    optParser.add_option("--orig-ids", dest="orig_ids", default=False, action="store_true",
                         help="Write original vehicle IDs instead of a running index")
    optParser.add_option("--ignore-gaps", dest="ignore_gaps", default=False, action="store_true",
                         help="Ignore steps where a vehicle is not in the network")
    optParser.add_option("--persons", default=False, action="store_true",
                         help="Include person data")
    # PHEM
    optParser.add_option("--dri-output", dest="dri", metavar="FILE",
                         help="Defines the name of the PHEM .dri-file to generate")
    optParser.add_option("--str-output", dest="str", metavar="FILE",
                         help="Defines the name of the PHEM .str-file to generate")
    optParser.add_option("--fzp-output", dest="fzp", metavar="FILE",
                         help="Defines the name of the PHEM .fzp-file to generate")
    optParser.add_option("--flt-output", dest="flt", metavar="FILE",
                         help="Defines the name of the PHEM .flt-file to generate")
    # OMNET
    optParser.add_option("--omnet-output", dest="omnet", metavar="FILE",
                         help="Defines the name of the OMNET file to generate")
    # Shawn
    optParser.add_option("--shawn-output", dest="shawn", metavar="FILE",
                         help="Defines the name of the Shawn file to generate")
    # ns2
    optParser.add_option("--ns2activity-output", dest="ns2activity", metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
    optParser.add_option("--ns2config-output", dest="ns2config", metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
    optParser.add_option("--ns2mobility-output", dest="ns2mobility", metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
    # GPSDAT
    optParser.add_option("--gpsdat-output", dest="gpsdat", metavar="FILE",
                         help="Defines the name of the gpsdat file to generate")
    # KML
    optParser.add_option("--kml-output", dest="kml", metavar="FILE",
                         help="Defines the name of the kml file to generate")
    # GPX
    optParser.add_option("--gpx-output", dest="gpx", metavar="FILE",
                         help="Defines the name of the gpx file to generate")
    # POI
    optParser.add_option("--poi-output", dest="poi", metavar="FILE",
                         help="Defines the name of the poi file to generate")
    # FCD
    optParser.add_option("--fcd-filter", dest="fcdfilter", metavar="FILE",
                         help="Defines the name of the filter definition file")
    # kepler.gl JSON
    optParser.add_option("--keplerjson-output", dest="keplerjson", metavar="FILE",
                         help="Defines the name of the kelper.gl JSON file to generate")
    optParser.add_option("--fcd-filter-comment", dest="fcdcomment",
                         help="Extra comments to include in fcd file")
    optParser.add_option("--fcd-filter-type", dest="fcdtype",
                         help="vehicle type to include in fcd file")
    # parse
    if len(args) == 1:
        sys.exit(USAGE.replace('%prog', os.path.basename(__file__)))
    options, remaining_args = optParser.parse_args(args=args)

    if options.seed:
        random.seed(options.seed)
    # ---------- process ----------
    net = None
    # ----- check needed values
    if options.delta and options.delta <= 0:
        print("delta-t must be a positive value.")
        return 1
    # phem
    if (options.dri or options.fzp or options.flt) and not options.fcd:
        print("A fcd-output from SUMO must be given using the --fcd-input.")
        return 1
    if (options.str or options.fzp or options.flt) and not options.net:
        print("A SUMO network must be given using the --net-input option.")
        return 1
    # omnet
    if options.omnet and not options.fcd:
        print("A fcd-output from SUMO must be given using the --fcd-input.")
        return 1
    # ----- check needed values

    # ----- OMNET
    if options.omnet:
        runMethod(options.fcd, options.omnet, omnet.fcd2omnet, options)
    # ----- OMNET

    # ----- Shawn
    if options.shawn:
        runMethod(options.fcd, options.shawn, shawn.fcd2shawn, options)
    # ----- Shawn

    # ----- GPSDAT
    if options.gpsdat:
        runMethod(options.fcd, options.gpsdat, gpsdat.fcd2gpsdat, options)
    # ----- GPSDAT

    # ----- KML
    if options.kml:
        runMethod(options.fcd, options.kml, kml.fcd2kml, options)
    # ----- KML

    # ----- GPX
    if options.gpx:
        runMethod(options.fcd, options.gpx, gpx.fcd2gpx, options)
    # ----- GPX

    # ----- POI
    if options.poi:
        runMethod(options.fcd, options.poi, poi.fcd2poi, options)
    # ----- POI

    # ----- FCD
    if options.fcdfilter:
        runMethod(options.fcd, None, fcdfilter.fcdfilter, options,
                  {"filter": options.fcdfilter, "comment": options.fcdcomment, "type": options.fcdtype})
    # ----- FCD

    # ----- kepler.gl JSON
    if options.keplerjson:
        runMethod(options.fcd, options.keplerjson, keplerjson.fcd2keplerjson, options)
    # ----- kepler.gl JSON

    # ----- ns2
    if options.ns2mobility or options.ns2config or options.ns2activity:
        vIDm, vehInfo, begin, end, area = runMethod(
            options.fcd, options.ns2mobility, ns2.fcd2ns2mobility, options)
    if options.ns2activity:
        o = _getOutputStream(options.ns2activity)
        ns2.writeNS2activity(o, vehInfo)
        _closeOutputStream(o)
    if options.ns2config:
        o = _getOutputStream(options.ns2config)
        ns2.writeNS2config(
            o, vehInfo, options.ns2activity, options.ns2mobility, begin, end, area)
        _closeOutputStream(o)
    # ----- ns2

    # ----- PHEM
    # .dri
    if options.dri:
        runMethod(options.fcd, options.dri, phem.fcd2dri, options)
    # .str (we need the net for other outputs, too)
    if options.str or options.fzp or options.flt:
        if not options.net:
            print("A SUMO network must be given using the --net-input option.")
            return 1
        if not net:
            net = sumolib.net.readNet(options.net)
        o = _getOutputStream(options.str)
        sIDm = phem.net2str(net, o)
        _closeOutputStream(o)
    # .fzp
    if options.flt or options.fzp:
        vIDm, vtIDm = runMethod(
            options.fcd, options.fzp, phem.fcd2fzp, options, {"phemStreetMap": sIDm})
    # .flt
    if options.flt:
        o = _getOutputStream(options.flt)
        phem.vehicleTypes2flt(o, vtIDm)
        _closeOutputStream(o)
    # ----- PHEM
    return 0
コード例 #2
0
ファイル: traceExporter.py プロジェクト: nitindesh/IFMS
def main(args=None):
  """The main function; parses options and converts..."""
  ## ---------- build and read options ----------
  from optparse import OptionParser
  optParser = OptionParser()
  optParser.add_option("-i", "--fcd-input", dest="fcd", metavar="FILE",
                         help="Defines the FCD-output file to use as input")
  optParser.add_option("-n", "--net-input", dest="net", metavar="FILE",
                         help="Defines the network file to use as input")
  optParser.add_option("-p", "--penetration", type="float", dest="penetration", 
                         default=1., help="Defines the percentage (0-1) of vehicles to export")
  optParser.add_option("-b", "--begin", dest="begin", 
                         type="float", help="Defines the first step to export")
  optParser.add_option("-e", "--end", dest="end", 
                         type="float", help="Defines the first step not longer to export")
  optParser.add_option("-d", "--delta-t", dest="delta", 
                         type="float", help="Defines the export step length")
  optParser.add_option("--gps-blur", dest="blur", default=0,
                         type="float", help="Defines the GPS blur")
  optParser.add_option("-s", "--seed", dest="seed", default=42,
                         type="float", help="Defines the randomizer seed")
  optParser.add_option("--base-date", dest="base", default=-1, type="int", help="Defines the base date")
  # PHEM
  optParser.add_option("--dri-output", dest="dri", metavar="FILE",
                         help="Defines the name of the PHEM .dri-file to generate")
  optParser.add_option("--str-output", dest="str", metavar="FILE",
                         help="Defines the name of the PHEM .str-file to generate")
  optParser.add_option("--fzp-output", dest="fzp", metavar="FILE",
                         help="Defines the name of the PHEM .fzp-file to generate")
  optParser.add_option("--flt-output", dest="flt", metavar="FILE",
                         help="Defines the name of the PHEM .flt-file to generate")
  # OMNET
  optParser.add_option("--omnet-output", dest="omnet", metavar="FILE",
                         help="Defines the name of the OMNET file to generate")
  # Shawn
  optParser.add_option("--shawn-output", dest="shawn", metavar="FILE",
                         help="Defines the name of the Shawn file to generate")
  # ns2
  optParser.add_option("--ns2activity-output", dest="ns2activity", metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
  optParser.add_option("--ns2config-output", dest="ns2config", metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
  optParser.add_option("--ns2mobility-output", dest="ns2mobility", metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
  # GPSDAT
  optParser.add_option("--gpsdat-output", dest="gpsdat", metavar="FILE",
                         help="Defines the name of the gpsdat file to generate")

  # GPX
  optParser.add_option("--gpx-output", dest="gpx", metavar="FILE",
                         help="Defines the name of the gpx file to generate")
  # POI
  optParser.add_option("--poi-output", dest="poi", metavar="FILE",
                         help="Defines the name of the poi file to generate")
  # parse
  options, remaining_args = optParser.parse_args(args=args)
  
  if options.seed:
    random.seed(options.seed)
  ## ---------- process ----------
  net = None
  ## ----- check needed values
  if options.delta and options.delta<=0:
    print("delta-t must be a positive value.")
    return 1
  # phem
  if (options.dri or options.fzp or options.flt) and not options.fcd:
    print("A fcd-output from SUMO must be given using the --fcd-input.")
    return 1
  if (options.str or options.fzp or options.flt) and not options.net:
    print("A SUMO network must be given using the --net-input option.")
    return 1
  # omnet
  if options.omnet and not options.fcd:
    print("A fcd-output from SUMO must be given using the --fcd-input.")
    return 1
  ## ----- check needed values
  
  ## ----- OMNET
  if options.omnet: runMethod(options.fcd, options.omnet, omnet.fcd2omnet, options)
  ## ----- OMNET

  ## ----- Shawn
  if options.shawn: runMethod(options.fcd, options.shawn, shawn.fcd2shawn, options)
  ## ----- Shawn

  ## ----- GPSDAT
  if options.gpsdat: runMethod(options.fcd, options.gpsdat, gpsdat.fcd2gpsdat, options)
  ## ----- GPSDAT

  ## ----- GPX
  if options.gpx: runMethod(options.fcd, options.gpx, gpx.fcd2gpx, options)
  ## ----- GPX

  ## ----- GPX
  if options.poi: runMethod(options.fcd, options.poi, poi.fcd2poi, options)
  ## ----- GPX

  ## ----- ns2
  if options.ns2mobility or options.ns2config or options.ns2activity: 
    vIDm, vehInfo, begin, end, area = runMethod(options.fcd, options.ns2mobility, ns2.fcd2ns2mobility, options)
  if options.ns2activity: 
    o = _getOutputStream(options.ns2activity)
    ns2.writeNS2activity(o, vehInfo)
    _closeOutputStream(o)
  if options.ns2config: 
    o = _getOutputStream(options.ns2config)
    ns2.writeNS2config(o, vehInfo, options.ns2activity, options.ns2mobility, begin, end, area)
    _closeOutputStream(o)
  ## ----- ns2

  ## ----- PHEM
  # .dri
  if options.dri: runMethod(options.fcd, options.dri, phem.fcd2dri, options)
  # .str (we need the net for other outputs, too)
  if options.str or options.fzp or options.flt:
    if not options.net:
      print("A SUMO network must be given using the --net-input option.")
      return 1
    if not net: net = sumolib.net.readNet(options.net)
    o = _getOutputStream(options.str)
    sIDm = phem.net2str(net, o)
    _closeOutputStream(o)
  # .fzp
  if options.flt or options.fzp: 
    vIDm, vtIDm = runMethod(options.fcd, options.fzp, phem.fcd2fzp, options, {"phemStreetMap":sIDm})
  # .flt    
  if options.flt:
    o = _getOutputStream(options.flt)
    phem.vehicleTypes2flt(o, vtIDm)
    _closeOutputStream(o)
  ## ----- PHEM
  return 0
コード例 #3
0
ファイル: traceExporter.py プロジェクト: sequielo/sumo
def main(args=None):
    """The main function; parses options and converts..."""
    # ---------- build and read options ----------
    USAGE = """Usage %prog -i <FCDDATA> [options] 
Converts the given fcd file (generated by sumo --fcd-output) into the selected
output format. Optionally the output can be sampled, filtered and distorted.
"""

    from optparse import OptionParser
    optParser = OptionParser(usage=USAGE)
    optParser.add_option("-i", "--fcd-input", dest="fcd", metavar="FILE",
                         help="Defines the FCD-output file to use as input")
    optParser.add_option("-n", "--net-input", dest="net", metavar="FILE",
                         help="Defines the network file to use as input")
    optParser.add_option("-p", "--penetration", type="float", dest="penetration",
                         default=1., help="Defines the percentage (0-1) of vehicles to export")
    optParser.add_option("-b", "--begin", dest="begin",
                         type="float", help="Defines the first step to export")
    optParser.add_option("-e", "--end", dest="end",
                         type="float", help="Defines the first step not longer to export")
    optParser.add_option("-d", "--delta-t", dest="delta",
                         type="float", help="Defines the export step length")
    optParser.add_option("--gps-blur", dest="blur", default=0,
                         type="float", help="Defines the GPS blur")
    optParser.add_option(
        "--boundary", help="Defines the bounding box as 'xmin,ymin,xmax,ymax'")
    optParser.add_option("-s", "--seed", dest="seed", default=42,
                         type="float", help="Defines the randomizer seed")
    optParser.add_option(
        "--base-date", dest="base", default=-1, type="int", help="Defines the base date")
    optParser.add_option("--orig-ids", dest="orig_ids", default=False, action="store_true",
                         help="Write original vehicle IDs instead of a running index")
    optParser.add_option("--ignore-gaps", dest="ignore_gaps", default=False, action="store_true",
                         help="Ignore steps where a vehicle is not in the network")
    optParser.add_option("--persons", default=False, action="store_true",
                         help="Include person data")
    # PHEM
    optParser.add_option("--dri-output", dest="dri", metavar="FILE",
                         help="Defines the name of the PHEM .dri-file to generate")
    optParser.add_option("--str-output", dest="str", metavar="FILE",
                         help="Defines the name of the PHEM .str-file to generate")
    optParser.add_option("--fzp-output", dest="fzp", metavar="FILE",
                         help="Defines the name of the PHEM .fzp-file to generate")
    optParser.add_option("--flt-output", dest="flt", metavar="FILE",
                         help="Defines the name of the PHEM .flt-file to generate")
    # OMNET
    optParser.add_option("--omnet-output", dest="omnet", metavar="FILE",
                         help="Defines the name of the OMNET file to generate")
    # Shawn
    optParser.add_option("--shawn-output", dest="shawn", metavar="FILE",
                         help="Defines the name of the Shawn file to generate")
    # ns2
    optParser.add_option("--ns2activity-output", dest="ns2activity", metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
    optParser.add_option("--ns2config-output", dest="ns2config", metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
    optParser.add_option("--ns2mobility-output", dest="ns2mobility", metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
    # GPSDAT
    optParser.add_option("--gpsdat-output", dest="gpsdat", metavar="FILE",
                         help="Defines the name of the gpsdat file to generate")

    # GPX
    optParser.add_option("--gpx-output", dest="gpx", metavar="FILE",
                         help="Defines the name of the gpx file to generate")
    # POI
    optParser.add_option("--poi-output", dest="poi", metavar="FILE",
                         help="Defines the name of the poi file to generate")
    # parse
    if len(args) == 1:
        sys.exit(USAGE.replace('%prog', os.path.basename(__file__)))
    options, remaining_args = optParser.parse_args(args=args)

    if options.seed:
        random.seed(options.seed)
    # ---------- process ----------
    net = None
    # ----- check needed values
    if options.delta and options.delta <= 0:
        print("delta-t must be a positive value.")
        return 1
    # phem
    if (options.dri or options.fzp or options.flt) and not options.fcd:
        print("A fcd-output from SUMO must be given using the --fcd-input.")
        return 1
    if (options.str or options.fzp or options.flt) and not options.net:
        print("A SUMO network must be given using the --net-input option.")
        return 1
    # omnet
    if options.omnet and not options.fcd:
        print("A fcd-output from SUMO must be given using the --fcd-input.")
        return 1
    # ----- check needed values

    ## ----- OMNET
    if options.omnet:
        runMethod(options.fcd, options.omnet, omnet.fcd2omnet, options)
    ## ----- OMNET

    ## ----- Shawn
    if options.shawn:
        runMethod(options.fcd, options.shawn, shawn.fcd2shawn, options)
    ## ----- Shawn

    ## ----- GPSDAT
    if options.gpsdat:
        runMethod(options.fcd, options.gpsdat, gpsdat.fcd2gpsdat, options)
    ## ----- GPSDAT

    ## ----- GPX
    if options.gpx:
        runMethod(options.fcd, options.gpx, gpx.fcd2gpx, options)
    ## ----- GPX

    ## ----- GPX
    if options.poi:
        runMethod(options.fcd, options.poi, poi.fcd2poi, options)
    ## ----- GPX

    ## ----- ns2
    if options.ns2mobility or options.ns2config or options.ns2activity:
        vIDm, vehInfo, begin, end, area = runMethod(
            options.fcd, options.ns2mobility, ns2.fcd2ns2mobility, options)
    if options.ns2activity:
        o = _getOutputStream(options.ns2activity)
        ns2.writeNS2activity(o, vehInfo)
        _closeOutputStream(o)
    if options.ns2config:
        o = _getOutputStream(options.ns2config)
        ns2.writeNS2config(
            o, vehInfo, options.ns2activity, options.ns2mobility, begin, end, area)
        _closeOutputStream(o)
    ## ----- ns2

    ## ----- PHEM
    # .dri
    if options.dri:
        runMethod(options.fcd, options.dri, phem.fcd2dri, options)
    # .str (we need the net for other outputs, too)
    if options.str or options.fzp or options.flt:
        if not options.net:
            print("A SUMO network must be given using the --net-input option.")
            return 1
        if not net:
            net = sumolib.net.readNet(options.net)
        o = _getOutputStream(options.str)
        sIDm = phem.net2str(net, o)
        _closeOutputStream(o)
    # .fzp
    if options.flt or options.fzp:
        vIDm, vtIDm = runMethod(
            options.fcd, options.fzp, phem.fcd2fzp, options, {"phemStreetMap": sIDm})
    # .flt
    if options.flt:
        o = _getOutputStream(options.flt)
        phem.vehicleTypes2flt(o, vtIDm)
        _closeOutputStream(o)
    ## ----- PHEM
    return 0
コード例 #4
0
def main(args=None):
    """The main function; parses options and converts..."""
    ## ---------- build and read options ----------
    from optparse import OptionParser
    optParser = OptionParser()
    optParser.add_option("-i",
                         "--fcd-input",
                         dest="fcd",
                         metavar="FILE",
                         help="Defines the FCD-output file to use as input")
    optParser.add_option("-n",
                         "--net-input",
                         dest="net",
                         metavar="FILE",
                         help="Defines the network file to use as input")
    optParser.add_option(
        "-p",
        "--penetration",
        type="float",
        dest="penetration",
        default=1.,
        help="Defines the percentage (0-1) of vehicles to export")
    optParser.add_option("-b",
                         "--begin",
                         dest="begin",
                         type="float",
                         help="Defines the first step to export")
    optParser.add_option("-e",
                         "--end",
                         dest="end",
                         type="float",
                         help="Defines the first step not longer to export")
    optParser.add_option("-d",
                         "--delta-t",
                         dest="delta",
                         type="float",
                         help="Defines the export step length")
    optParser.add_option("--gps-blur",
                         dest="blur",
                         default=0,
                         type="float",
                         help="Defines the GPS blur")
    optParser.add_option("-s",
                         "--seed",
                         dest="seed",
                         default=42,
                         type="float",
                         help="Defines the randomizer seed")
    optParser.add_option("--base-date",
                         dest="base",
                         default=-1,
                         type="int",
                         help="Defines the base date")
    # PHEM
    optParser.add_option(
        "--dri-output",
        dest="dri",
        metavar="FILE",
        help="Defines the name of the PHEM .dri-file to generate")
    optParser.add_option(
        "--str-output",
        dest="str",
        metavar="FILE",
        help="Defines the name of the PHEM .str-file to generate")
    optParser.add_option(
        "--fzp-output",
        dest="fzp",
        metavar="FILE",
        help="Defines the name of the PHEM .fzp-file to generate")
    optParser.add_option(
        "--flt-output",
        dest="flt",
        metavar="FILE",
        help="Defines the name of the PHEM .flt-file to generate")
    # OMNET
    optParser.add_option("--omnet-output",
                         dest="omnet",
                         metavar="FILE",
                         help="Defines the name of the OMNET file to generate")
    # Shawn
    optParser.add_option("--shawn-output",
                         dest="shawn",
                         metavar="FILE",
                         help="Defines the name of the Shawn file to generate")
    # ns2
    optParser.add_option("--ns2activity-output",
                         dest="ns2activity",
                         metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
    optParser.add_option("--ns2config-output",
                         dest="ns2config",
                         metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
    optParser.add_option("--ns2mobility-output",
                         dest="ns2mobility",
                         metavar="FILE",
                         help="Defines the name of the ns2 file to generate")
    # GPSDAT
    optParser.add_option(
        "--gpsdat-output",
        dest="gpsdat",
        metavar="FILE",
        help="Defines the name of the gpsdat file to generate")

    # GPX
    optParser.add_option("--gpx-output",
                         dest="gpx",
                         metavar="FILE",
                         help="Defines the name of the gpx file to generate")
    # POI
    optParser.add_option("--poi-output",
                         dest="poi",
                         metavar="FILE",
                         help="Defines the name of the poi file to generate")
    # parse
    options, remaining_args = optParser.parse_args(args=args)

    if options.seed:
        random.seed(options.seed)
    ## ---------- process ----------
    net = None
    ## ----- check needed values
    if options.delta and options.delta <= 0:
        print("delta-t must be a positive value.")
        return 1
    # phem
    if (options.dri or options.fzp or options.flt) and not options.fcd:
        print("A fcd-output from SUMO must be given using the --fcd-input.")
        return 1
    if (options.str or options.fzp or options.flt) and not options.net:
        print("A SUMO network must be given using the --net-input option.")
        return 1
    # omnet
    if options.omnet and not options.fcd:
        print("A fcd-output from SUMO must be given using the --fcd-input.")
        return 1
    ## ----- check needed values

    ## ----- OMNET
    if options.omnet:
        runMethod(options.fcd, options.omnet, omnet.fcd2omnet, options)
    ## ----- OMNET

    ## ----- Shawn
    if options.shawn:
        runMethod(options.fcd, options.shawn, shawn.fcd2shawn, options)
    ## ----- Shawn

    ## ----- GPSDAT
    if options.gpsdat:
        runMethod(options.fcd, options.gpsdat, gpsdat.fcd2gpsdat, options)
    ## ----- GPSDAT

    ## ----- GPX
    if options.gpx: runMethod(options.fcd, options.gpx, gpx.fcd2gpx, options)
    ## ----- GPX

    ## ----- GPX
    if options.poi: runMethod(options.fcd, options.poi, poi.fcd2poi, options)
    ## ----- GPX

    ## ----- ns2
    if options.ns2mobility or options.ns2config or options.ns2activity:
        vIDm, vehInfo, begin, end, area = runMethod(options.fcd,
                                                    options.ns2mobility,
                                                    ns2.fcd2ns2mobility,
                                                    options)
    if options.ns2activity:
        o = _getOutputStream(options.ns2activity)
        ns2.writeNS2activity(o, vehInfo)
        _closeOutputStream(o)
    if options.ns2config:
        o = _getOutputStream(options.ns2config)
        ns2.writeNS2config(o, vehInfo, options.ns2activity,
                           options.ns2mobility, begin, end, area)
        _closeOutputStream(o)
    ## ----- ns2

    ## ----- PHEM
    # .dri
    if options.dri: runMethod(options.fcd, options.dri, phem.fcd2dri, options)
    # .str (we need the net for other outputs, too)
    if options.str or options.fzp or options.flt:
        if not options.net:
            print("A SUMO network must be given using the --net-input option.")
            return 1
        if not net: net = sumolib.net.readNet(options.net)
        o = _getOutputStream(options.str)
        sIDm = phem.net2str(net, o)
        _closeOutputStream(o)
    # .fzp
    if options.flt or options.fzp:
        vIDm, vtIDm = runMethod(options.fcd, options.fzp, phem.fcd2fzp,
                                options, {"phemStreetMap": sIDm})
    # .flt
    if options.flt:
        o = _getOutputStream(options.flt)
        phem.vehicleTypes2flt(o, vtIDm)
        _closeOutputStream(o)
    ## ----- PHEM
    return 0