Skip to content

Import a Lanelet2 (.osm) file

drawtonomy can read Lanelet2 OSM-format maps. Sample maps are available from the Autoware documentation.

Importing a full Lanelet2 file.

Every .osm import goes through a selection preview — there is no “import everything immediately” shortcut. To bring in the whole file you select all of it in that preview:

  1. Open the menu (the hamburger at the top left) → Import….
  2. Pick the .osm file.
  3. drawtonomy parses the file and shows a preview map of the lanelets.
  4. Select everything (drag a box around the whole map, or use the select-all control), then click Import (N).
  5. The canvas fills with Lane shapes plus their connections.

If you only need part of a large map, select just those lanes instead — see Import only specific lanes below.

If you just want something to import, this is the smallest valid Lanelet2 .osm — one lanelet made of two boundary ways (a solid left edge and a dashed right edge) over six nodes. Save it as sample.osm and import it with the steps above; drawtonomy renders a single lane with the correct solid / dashed boundary styles.

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="hand-authored-lanelet2-sample">
<node id="1" lat="0.0000000" lon="0.0000000">
<tag k="local_x" v="0"/><tag k="local_y" v="0"/><tag k="ele" v="0"/>
</node>
<node id="2" lat="0.0000900" lon="0.0000000">
<tag k="local_x" v="0"/><tag k="local_y" v="10"/><tag k="ele" v="0"/>
</node>
<node id="3" lat="0.0001800" lon="0.0000180">
<tag k="local_x" v="2"/><tag k="local_y" v="20"/><tag k="ele" v="0"/>
</node>
<node id="4" lat="0.0000000" lon="0.0000320">
<tag k="local_x" v="3.5"/><tag k="local_y" v="0"/><tag k="ele" v="0"/>
</node>
<node id="5" lat="0.0000900" lon="0.0000320">
<tag k="local_x" v="3.5"/><tag k="local_y" v="10"/><tag k="ele" v="0"/>
</node>
<node id="6" lat="0.0001800" lon="0.0000500">
<tag k="local_x" v="5.5"/><tag k="local_y" v="20"/><tag k="ele" v="0"/>
</node>
<way id="10">
<nd ref="1"/><nd ref="2"/><nd ref="3"/>
<tag k="type" v="line_thin"/>
<tag k="subtype" v="solid"/>
</way>
<way id="11">
<nd ref="4"/><nd ref="5"/><nd ref="6"/>
<tag k="type" v="line_thin"/>
<tag k="subtype" v="dashed"/>
</way>
<relation id="100">
<member type="way" ref="10" role="left"/>
<member type="way" ref="11" role="right"/>
<tag k="type" v="lanelet"/>
<tag k="subtype" v="road"/>
<tag k="location" v="urban"/>
<tag k="one_way" v="yes"/>
</relation>
</osm>

The pieces that matter:

  • Nodes carry the geometry. Lanelet2 stores real-world lat / lon, and Autoware-style files also carry projected local_x / local_y.
  • Ways are the lane boundaries. type=line_thin with subtype=solid or subtype=dashed sets the road-mark style you see on import.
  • The lanelet relation ties one left way and one right way into a drivable lane. Add more lanelets (and share ways between neighbours) to build a network.

For large maps, importing every lane will slow the editor down. Use the lane-selection dialog instead:

Drag-select only the lanes you care about, then import.
  1. Open the menuImport… and pick the .osm file.
  2. drawtonomy shows a preview map.
  3. Click or drag to select the lanes you want.
  4. Click Import (N), where N is the number of lanes you selected.

drawtonomy handles large maps, so you can import a full Lanelet2 file when you need to. When you only care about a section, importing just the lanes you need keeps the editor snappiest and avoids loading geometry you won’t edit.

Imported lanes are full-fidelity Lane shapes; the connections from the Lanelet2 file are preserved. Edit, smooth, or export back without losing topology.

drawtonomy keeps the original .osm XML as a sidecar when you import. On export back to .osm (Lanelet2), original IDs and tags are preserved, and regulatory elements you didn’t touch — traffic lights, right-of-way, speed limits, stop signs — are re-emitted from that source verbatim.

Imported regulatory elements also become editable: traffic lights, traffic signs (including speed limits), stop lines, and right-of-way relations come in as drawtonomy shapes linked to the lanelets they govern, and you can place new ones from scratch with the same UI. For LiDAR-aligned or city-scale authoring, use Vector Map Builder or JOSM.