Skip to content

Commit

Permalink
Remove the dependency on https://github.com/a-b-street/osm2lanes and the
Browse files Browse the repository at this point in the history
experiment flag.

We've long since moved onto incrementally improving lane parsing code
here, rather than trying to cutover to the other repo. Simplify things.
  • Loading branch information
dabreegster committed Aug 5, 2023
1 parent 41656e5 commit c098792
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 428 deletions.
103 changes: 0 additions & 103 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ The osm2streets library itself (Rust):
- [osm2streets](https://github.com/a-b-street/osm2streets/tree/main/osm2streets) with the schema, transformations, rendering, etc
- [streets_reader](https://github.com/a-b-street/osm2streets/tree/main/streets_reader) to read `osm.xml` input
- [experimental](https://github.com/a-b-street/osm2streets/tree/main/osm2streets): an experimental crate for experimenting with implementation details.
- The logic for calculating lanes for a single road will eventually be owned by [osm2lanes](https://github.com/a-b-street/osm2lanes)

Bindings for other languages:

Expand Down
4 changes: 2 additions & 2 deletions docs/how_it_works.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ As of November 2022, and probably incomplete. This describes how the codebase cu

At its heart, a graph of roads and intersections. A `Road` is a segment of road that leads between exactly two `Intersection`s. An `Intersection`'s kind tells you if it represents a real-life intersection or some other kind of node in the graph. A `MapEdge` connects a single `Road` the edge of the map, a `Terminus` marks an actual dead end. A `Connection` joins multiple `Road`s together where there is no traffic interaction at all, whereas a `Fork` joins multiple roads that merge or diverge without any stop line. Finally, an `IntersectionKind::Intersection` represents everything that you would actually call an "intersection", where traffic merges with, diverges from or crosses other traffic.

Roads have their lanes listed from left-to-right, each with a type, width, and direction. A lane represents any longitudinal feature of a road: travel lanes on the carriageway, separated bike and footpaths, street-side parking, and buffers, medians and verges. Note osm2streets doesn't model bidirectional lanes yet -- sidewalks and shared center turn lanes are either forwards or backwards right now, and something downstream interprets them in a special way. (osm2lanes has more nuance, but isn't used in osm2streets yet.)
Roads have their lanes listed from left-to-right, each with a type, width, and direction. A lane represents any longitudinal feature of a road: travel lanes on the carriageway, separated bike and footpaths, street-side parking, and buffers, medians and verges. Note osm2streets doesn't model bidirectional lanes yet -- sidewalks and shared center turn lanes are either forwards or backwards right now, and something downstream interprets them in a special way.

### IDs

Expand All @@ -23,7 +23,7 @@ Roads and intersections have opaque (meaningless) IDs. At the very beginning, th

Extraction is straightforward. Since OSM ways often cross many intersections, they don't form a graph yet, so the split step finds nodes common to multiple ways and declares those intersections. Very small roundabouts also get collapsed to a single point here (a hack!). Raw turn restriction data and traffic signal nodes are also matched to a road. After this step, we have the first cut of a `StreetNetwork`. There are no movements filled out and geometry is almost exactly what OSM has.

But from this point, roads do have their lanes filled out, parsed from OSM tags. That currently uses `osm2streets/src/lanes/classic.rs`, but will use a separate project `osm2lanes` in the future.
But from this point, roads do have their lanes filled out, parsed from OSM tags. That currently uses `osm2streets/src/lanes/algorithm.rs`.

Clipping takes the boundary polygon (which should be passed in explicitly, but can also just be the bounding box around the input XML) and removes roads totally out of bounds. Roads crossing the boundary will get clipped to the boundary, and that intersection will be marked as a map edge.

Expand Down
2 changes: 0 additions & 2 deletions osm2streets-js/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub struct ImportOptions {
dual_carriageway_experiment: bool,
sidepath_zipping_experiment: bool,
inferred_sidewalks: bool,
osm2lanes: bool,
}

#[wasm_bindgen]
Expand Down Expand Up @@ -55,7 +54,6 @@ impl JsStreetNetwork {

let mut cfg = MapConfig::default();
cfg.inferred_sidewalks = input.inferred_sidewalks;
cfg.osm2lanes = input.osm2lanes;

let mut timer = Timer::throwaway();
let (mut street_network, doc) =
Expand Down
3 changes: 0 additions & 3 deletions osm2streets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ geojson = "0.24.1"
geom = { git = "https://github.com/a-b-street/abstreet" }
itertools = "0.10.5"
log = "0.4.14"
osm2lanes = { git = "https://github.com/a-b-street/osm2lanes" }
osm-tags = { git = "https://github.com/a-b-street/osm2lanes" }
osm-tag-schemes = { git = "https://github.com/a-b-street/osm2lanes" }
petgraph = { version = "0.6.3" }
serde = { workspace = true }
serde_json = { workspace = true }
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ use geom::Distance;
use crate::lanes::TurnDirection;
use crate::{osm, BufferType, Direction, DrivingSide, LaneSpec, LaneType, MapConfig};

/// Purely from OSM tags, determine the lanes that a road segment has. This is the "classic"
/// implementation -- the default, but on its way out.
/// Purely from OSM tags, determine the lanes that a road segment has.
pub fn get_lane_specs_ltr(tags: &Tags, cfg: &MapConfig) -> Vec<LaneSpec> {
if cfg.osm2lanes {
return super::osm2lanes::get_lane_specs_ltr_experimental(tags, cfg);
}

// TODO This hides a potentially expensive (on a hot-path) clone
let mut tags = tags.clone();
// This'll do weird things for the special cases of railways and cycleways/footways, but the
Expand Down
5 changes: 2 additions & 3 deletions osm2streets/src/lanes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod classic;
mod osm2lanes;
mod algorithm;
mod placement;
#[cfg(test)]
mod tests;
Expand All @@ -13,7 +12,7 @@ use serde::{Deserialize, Serialize};
use geom::Distance;

use crate::DrivingSide;
pub use classic::get_lane_specs_ltr;
pub use algorithm::get_lane_specs_ltr;

pub const NORMAL_LANE_THICKNESS: Distance = Distance::const_meters(3.0);
const SERVICE_ROAD_LANE_THICKNESS: Distance = Distance::const_meters(2.0);
Expand Down
Loading

0 comments on commit c098792

Please sign in to comment.