Any City Generator · Documentation

OpenStreetMap Import

The OSM Import tab turns the roads of a real place on OpenStreetMap into road networks that build and carry traffic like a generated city. This article covers getting the data, the options, what the clean-up does to the mapped roads, the import report, the generated profiles, runtime import, the known limits and the credit OpenStreetMap needs.

← All Any City Generator documentation

1 · The tab

Open the OSM Import tab

Open Tools > Any City Generator > Any City OSM Import. It is in the Tools menu only; there is no toolbar button. Each new tab starts with fresh options, and they are not saved.

▾ Buttons

Import OSM File Imports the .osm file in Osm File, clipped to the file's own bounds
Download From Overpass And Import Downloads every road in the South, West, North, East box from Overpass, saves it to Saved/AnyCity/Osm/<Import Name>.osm and imports it clipped to the box
Spawn Traffic Manager Spawns a traffic manager at the world origin when the level has none

Both imports run behind a progress dialog. The profile set is saved first, then the networks spawn in one undo step, Import OpenStreetMap: labelled <Import Name>_<x>_<y> in the outliner folder AnyCity/<Import Name>, built and not selected. Importing again with the same Import Name replaces the earlier import in that undo step, but only when the new import produced a network, so a failed import keeps the old one. Hand edits to imported layouts are lost; imports with other names stay, and networks in unloaded World Partition cells are not replaced.

2 · Getting data

Get the roads of a real place

The importer reads OpenStreetMap XML (.osm files) and keeps only the roads: ways tagged highway, with their nodes. Pick a source by the size of the area.

▾ Source → area

Export on openstreetmap.org A neighbourhood; the OSM API refuses more than 50 000 nodes. Then Import OSM File
Overpass, from the tab Up to 50 km². Set the box, then Download From Overpass And Import
Geofabrik extract + osmium Cities and regions, under 1 GiB per file. Then Import OSM File

For Overpass, set South, West, North and East in degrees. The tab checks the box (at most 50 km², not across the 180th meridian), the Import Name and the Overpass Url, then downloads in the background. The buttons stay disabled until the answer arrives; closing the tab cancels the download. Every road in the box comes with all its nodes, so roads keep their shape up to the cut.

For bigger areas, download a regional .osm.pbf from download.geofabrik.de, cut your box in degrees and keep the roads with their nodes, using two osmium commands: osmium extract -b W,S,E,N region-latest.osm.pbf -o area.osm.pbf, then osmium tags-filter area.osm.pbf w/highway -o roads.osm. Files of 1 GiB or more are refused. A file without bounds is centred on its roads and not clipped. Distances stay within 0.1 % up to about 10 km from the origin; split larger regions into neighbouring imports (section 3).

Server busy? Overpass is a shared public server. HTTP 429 or 504 means it is busy: nothing is downloaded or imported, so try again later (400 means the query was rejected). If the server's own time limit runs out, the import fails rather than bringing in half a town: try a smaller box or a larger Overpass Timeout Seconds.

3 · Options

The options that matter

The tab's options with their defaults. Settings holds the import rules; expand it for the second panel.

▾ Options

Osm File Empty. The .osm file Import OSM File reads
South, West, North, East 0. The Overpass box in degrees
Overpass Url, Overpass Timeout Seconds The overpass-api.de interpreter, 120 s. The server and its own time limit
Import Name OsmCity. Names the networks, their outliner folder and the download; no slashes, spaces or dots
Profile Folder /Game/AnyCity/OsmProfiles. Where the profile set DA_OsmProfiles_<Import Name> is saved
Settings The default rules: Highway Rules, driving side, city parts, origin and the clean-up limits
Spawn Traffic Manager If Missing On. Spawns a manager after a successful import when the level has none

▾ Settings

Highway Rules One row per OSM highway value: class, lanes, lane width, speed and sidewalks. Values without an imported row are skipped; service roads are off by default
Import Private Roads, Import Tunnels Off, off. Private ways and tunnels are skipped; tunnels import at ground height
Driving Side Right
Corner Radius 4 m. Curb radius at junctions; 0 at corners under 30°
City Parts 1. How many networks the import becomes; 0 or 1 keeps one city
Clip To Bounds On. Cuts roads at the bounds; every cut becomes a port
Origin Mode, World Offset Bounds Center, zero. Custom uses Origin Latitude and Longitude; World Offset moves every part

Tags on a way override its row: oneway, lanes, maxspeed and sidewalk; ways tagged access=no or private are skipped unless Import Private Roads is on. City Parts (Settings > Network) splits the road area into that many equal parts, in the grid closest to square: on a 1000 × 670 m map, 2 parts are left and right halves, 3 are three columns and 4 are 2 × 2. A road crossing from one part into another becomes two ports at one spot, stitched so traffic crosses. Smaller parts build and stream faster. Two separate imports stitch along a shared edge when they use the same Custom origin and share a clip boundary.

4 · Clean-up

How mapped roads become buildable roads

OpenStreetMap draws roads for maps: a divided road is two one-way ways, a roundabout is a ring, and one intersection is often several nodes. The import reshapes them in this order, then checks the result with the same road builder the networks use.

  • Clipping. Roads are cut at the bounds into ports; pieces too short to build there are removed.
  • Controls. Traffic signal, stop and give-way nodes control the first junction along their road within Signal Search Distance. A stop tagged stop=all gives an all-way stop; the strongest control wins.
  • Roundabouts. A small, round ring with two or more approaches and no road across it becomes one roundabout junction with the ring's lanes (1 to 3). Other rings stay one-way loops whose entries yield. A mini roundabout becomes a 9 m single-lane roundabout.
  • Divided roads. Two opposite one-way carriageways between the same junctions, within Max Divided Road Separation, become one two-way road with a median of 0 to 12 m.
  • Dead ends. Stubs shorter than Min Dead End Length, such as driveways and mapping fragments, are removed.
  • Junctions. Junction nodes too close together to build are merged into one junction, never wider than Max Junction Cluster Size and never across a bridge or tunnel. Redundant slip roads are removed.
  • Overlaps. Two roads between the same junctions that collide, such as a teardrop island or a way mapped twice, become one road. A sidewalk lying on another road is removed on the facing side, as in a real narrow street.
  • Bridges. OSM has no heights. A bridge rises Layer Height above the highest road it crosses, with ramps at Max Grade. A bridge over nothing imported, such as a river or railway, stays at ground level.
  • Checks. Segments still too short to build are repaired over up to three rounds; the rest are named in the messages and build without lanes or meshes. Links merging into a through road yield; other junctions keep the Auto control.

▾ Clean-up limits (Settings)

Convert Roundabouts, Max Roundabout Radius On, 45 m. Bigger rings stay one-way loops
Merge Divided Roads, Max Divided Road Separation On, 40 m. Carriageways farther apart stay separate
Max Junction Cluster Size 60 m. The widest group of nodes merged into one junction
Min Dead End Length 30 m. Shorter stubs are removed
Signal Search Distance 35 m. How far along the road a signal, stop or give-way finds its junction
Layer Height, Max Grade 7 m, 0.06. Bridge height above the road it crosses, and the steepest ramp

5 · The report

Read the import report

The tab's status line shows the result of the last action. The details are in the Output Log, under LogAxOsm (import notes) and LogAxRoad (the summary and builds).

▾ Status line

imported '<name>' as N networks Success, with the node, segment and port counts; ports between city parts included
Not built: N networks A network has an invalid layout, or Preview In Editor is off. See LogAxRoad
nothing was imported and the level is unchanged The import failed. The reasons are in LogAxOsm and LogAxRoad
Overpass answered with HTTP … 429 or 504: the server is busy, try again later. 400: the query was rejected. Nothing was downloaded
The Overpass download timed out locally Try a smaller box, a larger Overpass Timeout Seconds, or again later

▾ Output Log

Summary (LogAxRoad) Networks made and earlier ones replaced; nodes, segments and ports; roundabouts converted, junctions consolidated, divided roads merged, bridges; segments dropped and short segments; the origin's latitude and longitude
Import notes (LogAxOsm) At most one note per clean-up pass, plus warnings such as carriageways left lying on each other away from a junction
Short segments Still too short after the repairs. They build without lanes or meshes, and the messages name them
Size warnings A city part over 2000 segments, or an import over 2000 ports. Smaller parts build and stream faster
segment N has no profile The import's profile set was deleted. Import again to recreate it (section 6)

6 · Profiles

Edit the generated profiles

A road profile sets a road's lanes, widths, sidewalks, median and speed. Equal roads share one, so a city needs a few dozen, and the editor keeps every profile of an import inside one asset: <Profile Folder>/DA_OsmProfiles_<Import Name>. These profiles are separate from the generator presets' profiles, such as DA_City_Metro's.

  • Edit inline. Open the set and change a profile. The change applies to every road using it, now and in later imports of that name, which reuse the set's profiles as they are.
  • See the edit with Rebuild All Networks in the Any City Generator panel.
  • Names say what a profile is. DA_Osm_Arterial_F2B2_W350_S300x300_M200_V60 is an arterial with 2 lanes forward and 2 back, 350 cm lanes, 300 cm sidewalks on both sides, a 200 cm median and 60 km/h.
  • One set serves both driving sides. Profiles are authored for right-hand traffic; left-hand networks mirror them.
  • Unused profiles stay. Profiles a re-import no longer uses remain in the set; to start fresh, delete the set and import again.

Keep the set while its networks exist. Placed networks reference the profiles inside it. Delete it and a segment without a profile fails its network's whole build (segment N has no profile) until you import again, which recreates the set. Undoing an import keeps the set. If another kind of asset already has the set's name, the import stops with one error.

7 · Runtime

Import while the game runs

Blueprint and game code can import a map at runtime with these nodes. For editor scripts that do what the tab does, see Editing, JSON and Scripting.

  • Make Default Import Settings gives the default rules. Start from it: a Make node leaves Highway Rules empty, which the import refuses.
  • Import Osm File or Import Osm Xml returns the import result: its parts, counts, messages and origin. It runs synchronously on the game thread.
  • Spawn Osm Networks spawns one network per part; each builds in BeginPlay. With runtime profiles it refuses the editor level, which could not be saved; PIE and game worlds accept it.
  • Keep the profile factory (Construct Object of AxOsmProfileFactory, held in a variable) for as long as the networks exist.
  • Package your .osm files. Relative paths resolve against Content. Add their folder to Additional Non-Asset Directories To Package, or a packaged game will not find them.

8 · Limits and licensing

What the import leaves out, and the credit it needs

Check these known limitations before you plan a level around an import.

  • No terrain. Everything except bridges sits at Z 0.
  • No turn rules from the map. Turn restrictions (relations are skipped), turn:lanes and centre turn lanes are not imported; maxspeed:forward and maxspeed:backward are ignored.
  • Tunnels are off by default and import at ground height.
  • Roads only. Buildings, land use, footways and public transport are not imported.
  • Complex interchanges can keep short segments without lanes; the messages name them.
  • Steep bridge ends. Ports, tunnels and the roads under a raised bridge stay at 0, so a bridge near the import edge or next to the road it crosses can end steeper than Max Grade.

Credit OpenStreetMap contributors. OSM data is © OpenStreetMap contributors under the Open Database License (ODbL). A shipped game, video or image showing imported roads must credit “© OpenStreetMap contributors” where users see it, such as the credits or an about screen, pointing to openstreetmap.org/copyright. Distributing the road data itself, such as exported layouts, can bring ODbL's share-alike terms. The OSM Foundation's licence and attribution guidelines are authoritative; this is not legal advice.

Next: the traffic that drives these roads, and the road rules it follows.