Skip to main content

Convert Synchro UTDF data format to other formats, such as GMNS, SUMO, etc...

Project description

PyPI versionDownloads

utdf2gmns

Introduction

An AMS(Analysis, Modeling and Simulation) tool to convert utdf file to different formats, including GMNS, SUMO etc.

utdf2gmns explored an automatic process of network coordinating, traffic signal integration, traffic flow conversion from Synchro to SUMO, identifying both the feasibility and challenges involved. The approach began with a comparative analysis of traffic network features, data formats, and signal timing schemas between the two platforms. Key challenges in converting Synchro UTDF data into microsimulation-ready networks focusing on signal integration, spatial conversion, and turning flow accuracy. Signal conversion remains a critical bottleneck, requiring precise alignment of phasing, timing, and coordination data to ensure reliable simulation outcomes. Network conversion also presents difficulties, particularly in translating Synchro’s relative coordinate system into georeferenced formats compatible with GIS tools. Additionally, accurately transforming turning movement data is essential for modeling realistic intersection behavior but often involves tedious manual preprocessing.

While previous efforts have made progress in isolated aspects of the conversion process, none offer a fully automated and scalable end-to-end solution. To fill this gap, we introduce utdf2gmns, an open-source Python tool designed to automate the transformation of Synchro UTDF files into GMNS-compliant networks for SUMO simulation. The tool supports automatic geocoding, integration with the Sigma-X engine for intersection analysis, robust SUMO network generation, and extendibility to other microsimulation platforms. Future work will focus on expanding support for adaptive signal systems, incorporating real-time data inputs, and enhancing interoperability with additional simulation frameworks to promote reproducibility and collaborative research in traffic modeling.

Official Document: https://utdf2gmns.readthedocs.io/en/latest/

Official GitHub: https://github.com/xyluo25/utdf2gmns

Previous Development: https://github.com/asu-trans-ai-lab/utdf2gmns (Initial commit: Dec 17, 2022, total 144 commits)

Required Input Data

  • UTDF.csv (file name does not need to be UTDF.csv, it can be any name.)

Installation

pip install utdf2gmns

Quick Python Example

Notes:

  • This quick start guide assumes you have a valid UTDF file and the required dependencies installed.
  • The following example uses a sample UTDF file from the Bullhead City, AZ dataset. You can replace it with your own UTDF file as needed.
  • The example below uses automatic geocoding by default. You can choose to geocode automatically ::ref:: automatic_geociding or manually ::ref:: manual_geocoding as per your requirement.

Prepare your UTDF File

Please note that file name does not need to be UTDF.csv, it can be any name.

import utdf2gmns as ug

region_name = " Bullhead City, AZ"  # Name of the region the UTDF file represents
path_utdf = r"datasets\data_bullhead_seg4\UTDF.csv"  # Path to the UTDF file

Initialize the UTDF2GMNS

# Initialize the UTDF2GMNS object with the UTDF file and region name
net = ug.UTDF2GMNS(utdf_filename=path_utdf, region_name=region_name, verbose=False)

Signalized Intersection Calculation and Visualization (Optional)

This is the optional step to generate each signalized intersections and visualize them using Sigma-X engine. For large networks, this step may take a long time. (The code will print out total time taken for this step)

# Generate signalized intersections and visualize them using Sigma-X engine
net.utdf_to_gmns_signal_ints()

Geocoding Intersections (Use Automatic Geocoding)

# Geocode intersections using automatic geocoding method

# dist_threshold: The distance threshold for geocoding (default is 0.01 km), unit is km
net.geocode_utdf_intersections(dist_threshold=0.01)

Geocoding Intersections (Use Manual Geocoding)

# Geocode intersections using manual geocoding method
# This method could provide more accurate geocoding results,
# But it requires user to provide a single intersection coordinate.

# INTID is the intersection ID in UTDF file
# x_coord and y_coord are the coordinates of the intersection in decimal degrees (Latitude and Longitude)

single_coord={"INTID": "1", "x_coord": -114.568, "y_coord": 35.155}
net.geocode_utdf_intersections(single_intersection_coord=single_coord)

Create GMNS links (Optional)

# Create GMNS links (polygon-link or line-link)
# is_link_polygon: If True, create polygon links; if False, create line links (default is False)
net.create_gmns_links(is_link_polygon=False)

Save GMNS Network

This step will convert the UTDF network to GMNS format and save it to CSV and json files. Specifically, it will save the following files:

  • nodes.csv : Contains information about the nodes in the network.
  • links.csv : Contains information about the links in the network.
  • lane.csv: Contains information about the lanes in the network.
  • movement.csv: Contains information about movements on the network.
  • signal.json : Contains information about the signals of each signalized intersection in the network.
  • utdf_network.csv : Contains information from the UTDF file regarding the network configuration and settings.
  • utdf_nodes.csv : Contains information from the UTDF file regarding the nodes in the network.
  • utdf_links.csv : Contains information from the UTDF file regarding the links in the network.
  • utdf_lanes.csv : Contains information from the UTDF file regarding the lanes in the network.
  • utdf_phases.csv : Contains information from the UTDF file regarding the phases in the network.
  • utdf_timeplans.csv : Contains information from the UTDF file regarding the time plans in the network.
# Convert UTDF network to GMNS format (CSV and JSON files)
net.utdf_to_gmns(incl_utdf=True)

Convert UTDF Network to SUMO

Since we have already converted the UTDF network to GMNS format, we can now convert it to SUMO format. This step will save the following files:

  • nod.xml : Contains information about the nodes in the SUMO network.
  • edg.xml : Contains information about the edges in the SUMO network.
  • con.xml : Contains information about the connections in the SUMO network.
  • flow.xml : Contains information about the flow in the SUMO network.
  • add.xml : contains loop detectors information.
  • net.xml : Contains information about the network in the SUMO network.
  • rou.xml : Contains information about the routes in the SUMO network.
  • .sumocfg : Contains configuration information for the SUMO network.
# Convert UTDF network to SUMO format (SUMO files)

# sumo_name is the name of the SUMO network (default is "utdf_to_sumo")
net.utdf_to_sumo(sumo_name="", show_warning_message=True)

Visualize the Network

We provide two methods to visualize the network: Keplergl and Matplotlib.

  • Keplergl: A powerful tool for visualizing large-scale geospatial data.
  • Matplotlib: A widely used library for creating static, animated, and interactive visualizations in Python.
net_map = ug.plot_net_mpl(net, save_fig=True, fig_name="Bullhead_City.png")
net_map = ug.plot_net_keplergl(net, save_fig=True, fig_name="Bullhead_City.html")

Another way to visualize the network is to open .sumocfg file (Open use sumo-gui).

Quick Example (Full Code)

import utdf2gmns as ug

if __name__ == "__main__":

    region_name = " Bullhead City, AZ"
    path_utdf = r"datasets\data_bullhead_seg4\UTDF.csv"

    # Step 1: Initialize the UTDF2GMNS
    net = ug.UTDF2GMNS(utdf_filename=path_utdf, region_name=region_name)

    # Step 2: Geocode intersection
	# if user manually provide single intersection coordinate, such as:
	# single_coord={"INTID": "1", "x_coord": -114.568, "y_coord": 35.155}
	# Intersections will geocoded base on this point (Recommended Method)
    net.geocode_utdf_intersections(single_intersection_coord={}, dist_threshold=0.01)

    # Step 3: create network links: user can genrate polygon-link or line-link
    net.create_gmns_links(is_link_polygon=False)

    # Step 4: convert UTDF network to GMNS format (csv)
    net.utdf_to_gmns(incl_utdf=True)

    # Step 5 (optional): convert UTDF netowrk to SUMO
    net.utdf_to_sumo(sumo_name="", show_warning_message=False)

    # Step 6 (optional): visualize the network
    # create matplotlib png
    # ug.plot_net_mpl(net)

    # create keplergl interactive map
    # net_map = ug.plot_net_keplergl(net, save_fig=True, fig_name="Bullhead_City.html")

Call for Contributions

The utdf2gmns project welcomes your expertise and enthusiasm!

Small improvements or fixes are always appreciated. If you are considering larger contributions to the source code, please contact us through email:

Dr. Xiangyong Luo:  luoxiangyong01@gmail.com

Dr. Xuesong Simon Zhou:  xzhou74@asu.edu

Writing code isn't the only way to contribute to utdf2gmns. You can also:

  • Review pull requests
  • Help us stay on top of new and old issues
  • Develop tutorials, presentations, and other educational materials
  • Develop graphic design for our brand assets and promotional materials
  • Translate website content
  • Help with outreach and onboard new contributors
  • Write grant proposals and help with other fundraising efforts

For more information about the ways you can contribute to utdf2gmns, visit our GitHub. If you' re unsure where to start or how your skills fit in, reach out! You can ask by opening a new issue or leaving a comment on a relevant issue that is already open on GitHub.

How to Cite

If you use utdf2gmns in your work or research, please use the following entry:

Luo, X., Zhang, Y., Xu, G., Li, W., Wang, R., & Zhou, X. S. (2025, December). Automating Traffic Microsimulation from SYNCHRO UTDF to SUMO. In 2025 Winter Simulation Conference (WSC) (pp. 2320-2331). IEEE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

utdf2gmns-1.2.3.tar.gz (79.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

utdf2gmns-1.2.3-py3-none-any.whl (84.0 kB view details)

Uploaded Python 3

File details

Details for the file utdf2gmns-1.2.3.tar.gz.

File metadata

  • Download URL: utdf2gmns-1.2.3.tar.gz
  • Upload date:
  • Size: 79.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for utdf2gmns-1.2.3.tar.gz
Algorithm Hash digest
SHA256 1c52056450a685688e31f459f6c182d4241b3da6a46e1eb6398266ba3d55a6a8
MD5 1da5d0bde54afc1002b6b8944dba6baa
BLAKE2b-256 ac448ecc5f6900ec4d29c9792ba184273848e8a8c89b53646954b0276411fd87

See more details on using hashes here.

File details

Details for the file utdf2gmns-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: utdf2gmns-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 84.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for utdf2gmns-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1de8dad34174637536ef7646cba73d93fa543bfe1a7865d9019f9d45ac6edaf3
MD5 cf3dcdffaa7706a4df5f9ce1b6fd45a3
BLAKE2b-256 c8f9adabafe3cedacd65d3c31a1404cecdca96c9329f5bab6626b9f02933b9fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page