Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed osm2streets in map_model #1041

Open
dabreegster opened this issue Jan 3, 2023 · 2 comments
Open

Embed osm2streets in map_model #1041

dabreegster opened this issue Jan 3, 2023 · 2 comments

Comments

@dabreegster
Copy link
Collaborator

Currently the raw_map layer embeds osm2streets StreetNetwork, just adding A/B Street-specific stuff in addition (buildings, areas, transit routes, and things like crosswalks & modal filters that aren't yet in osm2streets). But then the map_model layer, which is used by the traffic sim and all the apps, has its own representation for roads and intersections, and all the osm2streets stuff is gone. This was OK to start, but it's starting to get a bit tricky:

  • A/B Street edits lane specs and needs to regenerate geometry and movements, so we have an adapter kind of hack around it now
  • Rendering code is starting to be duplicated between map_gui and osm2streets. And then again in Recreate OSM viewer with Bevy #1038 for Bevy
  • There are some osm2streets API concepts like RoadEdge that'd be useful to use over here now, but they're not easy to get at

I'd like to explore options for embedding StreetNetwork inside map_model::Map too. Reasons to be wary of this:

  • Keeping serialized file size small and loading times quick for large maps is important, potentially at the expense of code readability / API niceness
  • the API surface of Lane, Road, Intersection is huge and messy
  • Keeping some indirection / wrapper between osm2streets and here is a good idea for evolving the two codebases at different speeds

Another vague idea is to embed osm2streets::{Road, Intersection} structs inside of A/B Street equivalents, and keep a few extra fields over on this side

CC @BudgieInWA

@dabreegster
Copy link
Collaborator Author

A quick survey of https://github.com/a-b-street/abstreet/tree/main/map_model/src...

  • connectivity and pathfind are all about routing. Eventually this code should live in osm2streets (probably a separate crate). Consider splitting the pathfinder from the map model #852 is related
  • edits is all about modifying a map, undo/redo, saving edits so that they survive upstream OSM edits, etc. The relevant parts of this should also eventually live in osm2streets as an add-on crate.
  • make has some stuff unrelated to roads, but also the code for vehicle and walking turns currently lives here. That's something I want to move to osm2streets (and rewrite way more rigorously) soon

@dabreegster
Copy link
Collaborator Author

To make specific progress here, I think first using osm2streets rendering code and whittling down stuff in map_gui would be good. After a-b-street/osm2streets#199 happens, I'll experiment with some ideas for directly calling the osm2streets methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant