Quick Start Guide

Quick Python Example

Note

  • This quick start guide assumes you have a valid inpx file and the required dependencies installed.

Prepare your Input file

1import vissim2gmns as vg
2
3input_dir = "datasets/one_intersection/"

Automatically Convert .inpx, .fzp, .fhz to GMNS Format

 1import vissim2gmns as vg
 2
 3if __name__ == "__main__":
 4
 5    input_dir = "datasets/one_intersection/"  # Path to your input directory
 6
 7    vissim = vg.VISSIM2GMNS(input_dir)
 8    # results will be saved in the same input directory by default.
 9    vissim.vissim_to_gmns()
10
11    # if you want to specify the output directory, you can use the following code:
12    # output_dir = "path/to/your/output/directory/"
13    # net.vissim_to_gmns(output_dir=output_dir)

Control output files

 1import vissim2gmns as vg
 2
 3if __name__ == "__main__":
 4
 5    input_dir = "datasets/one_intersection/"  # Path to your input directory
 6
 7    vissim = vg.VISSIM2GMNS(input_dir)
 8
 9    isCsv = False  # Set to True if you want to save the output as csv files
10    isGeojson = True  # Set to True if you want to save the output as geojson files
11    isShp = False  # Set to True if you want to save the output as shp files
12
13    vissim.vissim_to_gmns(isCsv=isCsv, isGeojson=isGeojson, isShp=isShp)

Convert Single File: .inpx to .csv, .geojson and shp files

 1import vissim2gmns as vg
 2
 3if __name__ == "__main__":
 4    inpx_file = "datasets/one_intersection/Net.inpx"  # Path to your .inpx file
 5    output_dir = "datasets/one_intersection/output/"  # Path to your output directory
 6
 7    # this will convert to geojson file by default
 8    vg.vissim_inpx(inpx_file, output_dir=output_dir)
 9
10    # if you want to specify the output file format, you can use the following code:
11    isCsv = False  # Set to True if you want to save the output as csv files
12    isGeojson = True  # Set to True if you want to save the output as geojson files
13    isShp = False  # Set to True if you want to save the output as shp files
14    vg.vissim_inpx(inpx_file, output_dir=output_dir, isCsv=isCsv, isGeojson=isGeojson, isShp=isShp)

Convert Single File: .fzp to .csv, .geojson and shp files

 1import vissim2gmns as vg
 2
 3if __name__ == "__main__":
 4    inpx_file = "datasets/one_intersection/Net.inpx"  # Path to your .inpx file
 5    fzp_file = "datasets/one_intersection/Net.fzp"  # Path to your .fzp file
 6    output_dir = "datasets/one_intersection/output/"  # Path to your output directory
 7
 8    # this will convert to geojson file by default
 9    vg.vissim_fzp(fzp_file, output_dir=output_dir)
10
11    # if you want to specify the output file format, you can use the following code:
12    isCsv = False  # Set to True if you want to save the output as csv files
13    isGeojson = True  # Set to True if you want to save the output as geojson files
14    isShp = False  # Set to True if you want to save the output as shp files
15    vg.vissim_fzp(fzp_file, output_dir=output_dir, isCsv=isCsv, isGeojson=isGeojson, isShp=isShp)

Convert Single File: .fhz to .csv file

1import vissim2gmns as vg
2
3if __name__ == "__main__":
4    fhz_file = "datasets/one_intersection/Net.fhz"  # Path to your .fhz file
5    output_dir = "datasets/one_intersection/output/"  # Path to your output directory
6
7    # this will convert to csv file by default
8    vg.vissim_fhz(fhz_file, output_dir=output_dir)