Using SUMO netedit to design a simple network

Devon Fazekas
5 min readAug 17, 2022

--

Table of contents

- Introduction
- Prerequisites
- What is a network?
Network file format
netconvert
netedit
- Create a network file using netedit
Draw the network
Finetune the edges and junctions
Saving the network
- Final thoughts

Introduction

In this article, we’ll walk through using the netedit tool to design a simple network file for the SUMO ecosystem.

This article is intended for beginners of SUMO and netedit, looking to learn the basics of drawing networks.

Prerequisites

I assume you have already installed SUMO on your machine and configured your PATH and SUMO_HOME environment variables. Read the documentation to learn how to get set up. To test that your machine is ready, you should be able to execute the following commands in a terminal:

  • sumo --version
  • sumo-gui
  • netedit

What is a network?

If you’re already familiar with the concepts of networks, skip to the section below titled “Create a network file using netedit”.

According to official documentation, a SUMO network is a directed graph comprised of junctions and edges.

  • junction” (aka. “intersection” or “node”): A single point where at least one edge starts or ends.
  • edge” (aka. “street”): A single-directed street connection between two junctions, and containing at least one lane.

Network file format

For SUMO, networks can get quite large and complex, so it’s best practice to group their components together in a single file, called a network file (who would have guess?). A network file can be of two formats:

  • a set of plain-xml files describing the network topology and geometry.
  • the .net.xml file used by the simulation, containing lots of generated information.

Only the plain-xml format is meant to be edited by the users.

Regardless of which format you have or want, SUMO provides tools to work and convert between them. The two most relevant tools include netconvert and netedit.

netconvert

netconvert is a command line application included in SUMO that generates road networks from different sources. Read the documentation to learn more about its usage. netconvert can convert between both network formats without information loss.

netedit

netedit is a graphical network editor included in SUMO and built on top of netconvert. Read the documentation to learn more of its usage.

Create a network file using netedit

In this section, we’ll walk through the process of using netedit to generate a network file. As previously mentioned, a network is a directed graph of junctions with edges connecting them.

The design of the network we’re creating is simple, as shown below. In fact, it’s an unrealistically simple network containing only 11 junctions and 14 edges.

Screenshot of a network viewed in netedit.
Screenshot of the network viewed in netedit.

To reduce any guesswork in following along with the above network design, the below tables list all the relevant junction and edge info needed. We’ll refer back to these tables.

Table of junction metadata.
Table of edge metadata.

Draw the network

You’re now ready to start using netedit to design a network and ultimately generate a network file. Let’s get started!

First, open netedit from a command line using the command netedit. Immediately create a new network with the File > select “New Network” button. This will provide you with a blank canvas for drawing the network.

We’ll start with placing the junctions on the canvas. In netedit, creating two junctions automatically generates the connecting edge (cool!). Read the documentation to learn more about creating edges in netedit. To create an edge, enter edge mode by hitting the [e] key or clicking its button in the control panel.

Entering Edge Mode in netedit to create a rectangular network.
Entering Edge Mode in netedit to create a rectangular network.

For convenience, turn on edge chain mode to allow chaining multiple edges without interruptions and show grid (not shown here, sorry!) to help with placement. At this point, you can randomly place all of our junctions as we’ll finetune their positions and other attributes in the next steps.

Finetune the edges and junctions

So you’ve placed all your edges/junctions on the canvas. Great! Now is the time to finetune and adjust their attributes.

To view attributes, you first must enter inspect mode by hitting the [i] key or clicking its button in the control panel.

When clicking on any element on the canvas, its attributes display on the left panel. There are many customizable attributes for each type of element. For our purposes, we only care about a few. Specifically, for edges, we’ll rename their id if necessary, and set numLanes according to the tables above. Although the from and to attributes are relevant, netedit automatically syncs them to the connected junctions.

Increasing number of edge lanes using netedit.
Increasing number of edge lanes using netedit.

For junctions, we’ll also rename their id if necessary, and change their pos according to the tables above.

Changing junction position using netedit.
Changing junction position using netedit.

Saving the network

If the attributes of your edges and junctions match the tables above, then your network should look like the designs from earlier. In that case, your network is now complete!

Save your network by hitting the [CTRL + s] key or pressing the File > Save Network As…” button. While a network file must have a “.net.xml” extension, the name can be virtually anything. I suggest naming the file something relevant such as “network.net.xml”.

Final thoughts

In this article, you learned the basics of network formats, some tools for designing and modifying networks, and got hands-on experience in creating your own network file.

If you’re interested in applying what you’ve learned, check out my other tutorials.

If you have any questions/suggestions, let’s connect on Github or LinkedIn!

https://github.com/DFazekas

https://www.linkedin.com/in/devon-fazekas

--

--

Devon Fazekas

Meet Devon, an entrepreneur who is passionate about helping others live better lives by creating environments that encourage creativity and innovation.