Expand description
map_model
describes the world where simulations occur. Importing a map from OSM partly happens
in convert_osm
and here.
Helpful terminology:
- ch = contraction hierarchy, for speeding up pathfinding
- degenerate intersection = only has 2 roads connected, so why is it an intersection at all?
- lc = lane-change (which is modelled very strangely: https://a-b-street.github.io/docs/tech/trafficsim/discrete_event/index.html#lane-changing)
- ltr = left-to-right, the order of lanes for a road
- osm = OpenStreetMap
Map objects are usually abbreviated in method names:
- a = area
- b = building
- tr = transit route
- ts = transit stop
- i = intersection
- l = lane
- pl = parking lot
- r = road
- ss = stop sign
- t = turn
- ts = traffic signal
Modules§
- city 🔒
- connectivity
- edits 🔒
- Once a Map exists, the player can edit it in the UI (producing
MapEdits
in-memory), then save the changes to a file (asPermanentMapEdits
). See https://a-b-street.github.io/docs/tech/map/edits.html. - make 🔒
- See https://a-b-street.github.io/docs/tech/map/importing/index.html for an overview. This module covers the RawMap->Map stage.
- map 🔒
- A bunch of (mostly read-only) queries on a Map.
- objects 🔒
- osm
- Useful utilities for working with OpenStreetMap.
- pathfind 🔒
- Everything related to pathfinding through a map for different types of agents.
- traversable 🔒
Structs§
- Access
Restrictions - Amenity
- A business located inside a building.
- Area
- Areas are just used for drawing.
- AreaID
- Building
- A building has connections to the road and sidewalk, may contain commercial amenities, and have off-street parking.
- BuildingID
- City
- A single city (like Seattle) can be broken down into multiple boundary polygons (udistrict, ballard, downtown, etc). The load map screen uses this struct to display the entire city.
- Compressed
MovementID - This is cheaper to store than a MovementID. It simply indexes into the list of movements.
- Control
Stop Sign - Control
Traffic Signal - A traffic signal consists of a sequence of Stages that repeat in a cycle. Most Stages last for a fixed duration. During a single Stage, some movements are protected (can proceed with the highest priority), while others are permitted (have to yield before proceeding).
- Crossing
- Diagonal
Filter - A diagonal filter exists in an intersection. It’s defined by two roads (the order is arbitrary). When all of the intersection’s roads are sorted in clockwise order, this pair of roads splits the ordering into two groups. Turns in each group are still possible, but not across groups.
- Directed
RoadID - Edit
Effects - Edit
Intersection - Edit
Road - ExtraPOI
- Extra point-of-interest
- Intersection
- An intersection connects roads. Most have >2 roads and are controlled by stop signs or traffic signals. Roads that lead to the boundary of the map end at border intersections, with only that one road attached.
- Intersection
Cluster - This only applies to VehiclePathfinder; walking through these intersections is nothing special. And in fact, even lanes only for buses/bikes are ignored.
- IntersectionID
- Lane
- A road segment is broken down into individual lanes, which have a LaneType.
- LaneID
- A lane is identified by its parent road and its position, ordered from the left.
- Lane
Spec - Map
- MapConfig
- MapEdits
- Represents changes to a map. Note this isn’t serializable – that’s what
PermanentMapEdits
does. - Movement
- A Movement groups all turns from one road to another, letting traffic signals and pathfinding operate at a higher level of abstraction.
- MovementID
- A movement is like a turn, but with less detail – it identifies a movement from one directed road to another. One road usually has 4 crosswalks, each a singleton Movement. We need all of the information here to keep each crosswalk separate.
- Name
PerLanguage - None corresponds to the native name
- Original
Road - Refers to a road segment between two nodes, using OSM IDs. Note OSM IDs are not stable over time and the relationship between a road/intersection and way/node isn’t 1:1 at all.
- Parking
Lot - Parking lots have some fixed capacity for cars, and are connected to a sidewalk and road.
- Parking
LotID - Path
- Path
Request - PathV2
- A path between two endpoints for a particular mode. This representation is immutable and doesn’t prescribe specific lanes and turns to follow.
- Pathfinder
- Pathfinder
Cache - For callers needing to request paths with a variety of RoutingParams. The caller is in charge of the lifetime, so they can clear it out when appropriate.
- Permanent
MapEdits - MapEdits are converted to this before serializing. Referencing things like LaneID in a Map won’t work if the basemap is rebuilt from new OSM data, so instead we use stabler OSM IDs that’re less likely to change.
- Position
- Represents a specific point some distance along a lane.
- RawTo
MapOptions - Options for converting RawMaps to Maps.
- Road
- A Road represents a segment between exactly two Intersections. It contains Lanes as children.
- Road
Filter - A filter placed somewhere along a road
- RoadID
- Road
SideID - Road
With Stop Sign - Routing
Params - Tuneable parameters for all types of routing.
- Stage
- Transit
Route - Transit
RouteID - Transit
Stop - Transit
StopID - Turn
- A Turn leads from the end of one Lane to the start of another. (Except for pedestrians; sidewalks are bidirectional.)
- TurnID
- Turns are uniquely identified by their (src, dst) lanes and their parent intersection. Intersection is needed to distinguish crosswalks that exist at two ends of a sidewalk.
- Uber
Turn - Zone
- A contiguous set of roads with access restrictions. This is derived from all the map’s roads and kept cached for performance.
Enums§
- Amenity
Type - Businesses are categorized into one of these types.
- Area
Type - Buffer
Type - Building
Type - Common
Endpoint - Crossing
Type - Classifies pedestrian and cyclist crossings. Note lots of detail is missing.
- Direction
- Driving
Side - EditCmd
- Edit
Intersection Control - ExtraPOI
Type - Filter
Type - The type of a modal filter. Most of these don’t have semantics yet; the variation is just for visual representation
- Intersection
Control - The kind of traffic control present at an intersection.
- Intersection
Kind - What kind of feature an
Intersection
actually represents. Any connection between roads in the network graph is represented by anIntersection
, but many of them are not traffic “intersections” in the common sense. - Lane
Type - Offstreet
Parking - Represent no parking as Private(0, false).
- Path
Constraints - Who’s asking for a path?
- Path
Step - Path
Step V2 - One step along a path.
- Pathfinder
Caching - When pathfinding with different
RoutingParams
is done, a temporary pathfinder must be created. This specifies what type of pathfinder and whether to cache it. - Restriction
Type - Side
OfRoad - See https://wiki.openstreetmap.org/wiki/Forward_%26_backward,left%26_right.
- Stage
Type - Traversable
- Either a lane or a turn, where most movement happens.
- Turn
Priority - Turn
Type
Constants§
- MAX_
BIKE_ SPEED - MAX_
WALKING_ SPEED - NORMAL_
LANE_ THICKNESS - PARKING_
LOT_ SPOT_ LENGTH - From some manually audited cases in Seattle, the length of parallel street parking spots is a bit different than the length in parking lots, so set a different value here.
- SIDEWALK_
THICKNESS