Skip to content

GMNS

Part of 3. GMNS network.

duckosm gmns writes the network in GMNS, the table format of DTALite, Path4GMNS and other network models, with your OSM fixes. Each GMNS link_id is the duckOSM edge_id. In driving, the links are the edges of driving.edges and also the bus-only edges of driving.private_edges (access = 'bus': a bus lane against a one-way street, or a bus-only road). duckOSM does not route on these edges, so they are not in driving.edges. In GMNS they have allowed_uses bus (or bus,bike) and one lane. On Monaco, the 18 bus-only edges give 18 links and 4 nodes more than driving.edges and driving.nodes.

Reference and format
Format GMNS 0.97: all tables in one DuckDB file, and with --to-csv the CSV files of the specification
Reference tool frictionless (the schemas) and Path4GMNS (a route on the network)
Check the CSV files pass the schemas of the specification, and Path4GMNS loads them and finds a route. --check checks the values: link ends, lengths, lane numbers, movements. How each output is checked
pip install "duckosm[sumo]"                      # optional: only for --lane-source netconvert

# Input: Level 2 routable database (monaco.duckdb)
# Output: Level 3 GMNS database (monaco_gmns.duckdb by default, or with -o)
duckosm gmns monaco.duckdb                       # -> creates monaco_gmns.duckdb
duckosm gmns monaco.duckdb -o out/gmns.duckdb    # custom output file path
duckosm gmns monaco.duckdb --to-csv gmns/        # also exports standard GMNS CSVs into gmns/

Macro, meso and micro

duckosm gmns makes the macro network. --meso and --micro add two more detailed networks of the same roads:

Network One link is For
macro (duckosm gmns) one direction of a road, from junction to junction, with its lanes as attributes traffic assignment and routing: DTALite, Path4GMNS
meso (--meso) a road section, and a connector for each legal turn through a junction simulators that move groups of vehicles along roads and through junctions
micro (--micro) a cell of about 7 m of one lane, a lane change, or a lane-to-lane turn simulators that move each vehicle cell by cell and lane by lane
duckosm gmns monaco.duckdb --meso --micro                  # creates monaco_gmns.duckdb with meso_driving & micro_driving
duckosm gmns monaco.duckdb -o out/gmns.duckdb --meso      # writes to custom output path
duckosm gmns-viz monaco_gmns.duckdb                        # draws the meso and micro networks in an interactive HTML viewer

Network schemas

In <area>_gmns.duckdb, every network table belongs to a network schema. The default main schema has only elevation_metadata, when the source db has heights. GMNS is dedicated purely to transport networks, unlike Level 2 (<area>.duckdb) which also stores GIS layers (features) and raw OSM tags (raw).

duckOSM cuts roads where a footpath or a cycleway crosses them. Thus the walking, cycling and driving networks meet at the same node_id. Why GMNS keeps the edges, and where each level uses chains: Edges and chains.

Each gmns_<mode>.link is one Level 2 edge: link_id = edge_id. GMNS does not merge links. Thus each crossing node stays in each mode, and gmns_all can join the modes on link_id.

One road section between two junctions is one row of gmns_driving.chains (Level 2: driving.chains). SUMO and MATSim --merge read it.

Macro schemas (duckosm gmns)

  • gmns_driving (18 tables): The vehicular road network for cars, trucks, and buses. Models lanes (lane), lane-level turns with restrictions (movement), signals (signal_controller), on-street parking (curb_seg), crosswalks spanning road lanes (crossing, lane_crossing), smooth intersection curves (lane_connector), and the road chains for --merge (chains).
  • gmns_walking (15 tables): Sidewalks, footpaths, stairs, plazas, and crosswalks. Tracks parallel roadways via link_along, connects footways to road crossings via lane_connector, and lists unpaired lanes in lane_check.
  • gmns_cycling (14 tables): Cycleways, protected bike paths, shared lanes, and bikeable roads. Tracks parallel roadways via link_along.
  • gmns_all (5 tables, via --combined): Merges shared physical streets across driving, walking, and cycling into a single link with unioned allowed_uses = 'auto,bike,walk' (link_id = edge_id). Lanes and turns stay in the mode schemas.

Meso and micro schemas (--meso, --micro)

  • meso_<mode> (2 tables, via --meso): Road sections (meso_link, trimmed ~6 m from junctions) and junction turn connectors between section endpoints (meso_node). Default: meso_driving.
  • micro_<mode> (2 tables, via --micro): Discrete 7-meter lane cells, lateral lane changes, and turn movements (micro_link) between cell boundary vertices (micro_node). Default: micro_driving.

  • In DuckDB (.duckdb): Stores all tables with native DuckDB spatial geometries (geom) for fast spatial SQL queries and map rendering.

  • In CSV (--to-csv): Exports the standard specification tables with WKT text geometries (geometry), ready for DTALite and Path4GMNS.

See the complete table matrix and column definitions in GMNS network tables.

One junction in GMNS: a node, a link with two lanes, and the movements each lane can take

Meso and micro networks

duckosm gmns --meso --micro adds two networks for simulators that work below the road: road sections (meso) and lane cells (micro), with your OSM fixes. The ids come from edge_id, so they stay the same after each build.

Network Table One row is
meso meso_<mode>.meso_node the end of a road section
meso_<mode>.meso_link a road section, about 6 m shorter than its road at each end, or a connector: a curve for one legal turn between two sections
micro micro_<mode>.micro_node the start of a cell of a lane
micro_<mode>.micro_link a cell of about 7 m, a lane change between cells side by side, or a turn through a junction
Table Columns
meso_node node_id (<link_id>u start, <link_id>d end), x_coord, y_coord, macro_node_id, macro_link_id, geom
meso_link link_id (M<link_id> a section, X<ib>-<ob> a connector), meso_type (normal, movement), from_node_id, to_node_id, length, lanes, free_speed, facility_type, macro_link_id, movement_id, start_ib_lane, end_ib_lane, geometry, geom
micro_node node_id (<lane_id>@<k>), x_coord, y_coord, lane_id, cell_k, macro_link_id, lane_no, geom
micro_link link_id (C… a cell, H… a lane change, X… a turn), cell_type (normal, lane_change, movement), from_node_id, to_node_id, length, width, lane_no, macro_link_id, meso_link_id, geometry, geom

Lengths are in metres, and each link starts and ends at its nodes.

Lanes from OSM tags

OSM tag Gives
lanes, lanes:forward, lanes:backward the number of lanes in each direction
turn:lanes the turns of each lane
width:lanes the width of each lane
bicycle:lanes, psv:lanes bike lanes and bus lanes

Most ways have none of these tags, so most lanes are general lanes with a default width.

See it

duckosm levels monaco.duckdb, then duckosm gmns-map monaco_gmns.duckdb --source-db monaco.duckdb, draws each lane at its width on a base map. Click a lane: it turns red, and the lanes that its turns lead into turn green.

Speed and memory

Driving network, with the lane rules (the default). Input is the Level 2 routable database (<area>.duckdb). Memory is the peak of the whole process, Rust and DuckDB (DuckDB has a limit of 2 GB):

Area (input DuckDB) Machine Time Memory Output GMNS DuckDB
Monaco (38 MB .duckdb) Mac mini (M6, 16 GB) 0.34 s 0.15 GB 9.5 MB
Kentucky (2.2 GB .duckdb) Mac mini (M6, 16 GB) 71 s 5.2 GB 7.5 GB
Île-de-France (2.0 GB .duckdb) Mac mini (M6, 16 GB) 61 s 5.0 GB 3.0 GB
France (~35 GB .duckdb) not run (estimated ~150 GB)

Each step works in chunks (a chunk of junctions, of road runs or of lanes), so the memory stays about the same on a large area. DuckDB has a limit of 2 GB and spills to disk above it. With --lane-source netconvert, netconvert reads the whole area at once and needs much more memory.

All options: Command line.