utdf2gmns

Convert Synchro UTDF data (UDTF.csv) to standard formats such as GMNS, SUMO, etc...

https://github.com/xyluo25/utdf2gmns

Science Score: 39.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.7%) to scientific vocabulary

Keywords

gmns microsimulation sumo traffic-simulation utdf
Last synced: 6 months ago · JSON representation

Repository

Convert Synchro UTDF data (UDTF.csv) to standard formats such as GMNS, SUMO, etc...

Basic Info
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • Open Issues: 4
  • Releases: 3
Topics
gmns microsimulation sumo traffic-simulation utdf
Created over 1 year ago · Last pushed 8 months ago
Metadata Files
Readme License Code of conduct Citation Security

README.md

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 Synchros 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

  • [X] 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:: automaticgeociding or manually ::ref:: manualgeocoding 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.

```python import utdf2gmns as ug

regionname = " Bullhead City, AZ" # Name of the region the UTDF file represents pathutdf = r"datasets\databullheadseg4\UTDF.csv" # Path to the UTDF file ```

Initialize the UTDF2GMNS

```python

Initialize the UTDF2GMNS object with the UTDF file and region name

net = ug.UTDF2GMNS(utdffilename=pathutdf, regionname=regionname, 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)

```python

Generate signalized intersections and visualize them using Sigma-X engine

net.utdftogmnssignalints() ```

Geocoding Intersections (Use Automatic Geocoding)

```python

Geocode intersections using automatic geocoding method

dist_threshold: The distance threshold for geocoding (default is 0.01 km), unit is km

net.geocodeutdfintersections(dist_threshold=0.01) ```

Geocoding Intersections (Use Manual Geocoding)

```python

Geocode intersections using manual geocoding method

This method could provide more accurate geocoding results,

Bit it requires user to provide a single intersection coordinate.

INTED is the intersection ID in UTDF file

xcoord and xcoord are the coordinates of the intersection in decimal degrees (Latitude and Longitude)

singlecoord={"INTID": "1", "xcoord": -114.568, "xcoord": 35.155} net.geocodeutdfintersections(singleintersectioncoord=singlecoord) ```

Create GMNS links

```python

Create GMNS links (polygon-link or line-link)

islinkpolygon: If True, create polygon links; if False, create line links (default is False)

net.creategmnslinks(islinkpolygon=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.
  • 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.

```python

Convert UTDF network to GMNS format (CSV and JSON files)

net.utdftogmns(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.

```python

Convert UTDF network to SUMO format (SUMO files)

sumoname is the name of the SUMO network (default is "utdfto_sumo")

net.utdftosumo(sumoname="", showwarning_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.

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 generate .sumocfg file (Open use sumo-gui).

Quick Example (Full Code)

```python 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:

plaintext Xiangyong, Luo and Xuesong SimonZhou. xyluo25/utdf2gmns: V1.0.0. Zenodo, December 17, 2022. https://doi.org/10.5281/zenodo.14825686.

Owner

  • Name: xyluo25
  • Login: xyluo25
  • Kind: user
  • Location: USA

GitHub Events

Total
  • Create event: 9
  • Issues event: 3
  • Release event: 3
  • Delete event: 5
  • Public event: 1
  • Push event: 54
  • Pull request event: 2
Last Year
  • Create event: 9
  • Issues event: 3
  • Release event: 3
  • Delete event: 5
  • Public event: 1
  • Push event: 54
  • Pull request event: 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 4
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 5 hours
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 5 hours
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • xyluo25 (4)
Pull Request Authors
  • xyluo25 (2)
  • Yiran6 (1)
Top Labels
Issue Labels
enhancement (4) help wanted (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 427 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 16
  • Total maintainers: 2
pypi.org: utdf2gmns

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

  • Versions: 16
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 427 Last month
Rankings
Dependent packages count: 7.3%
Forks count: 23.1%
Average: 27.7%
Stargazers count: 39.2%
Dependent repos count: 41.3%
Maintainers (2)
Last synced: 6 months ago