Shared library for OSM tags -> lane specification #789
Replies: 9 comments 27 replies
-
APIThe API would just have a function that transforms a string->string dictionary of key/values for a single OSM way into an ordered list of lane specifications. So as a very simple example, for something like https://www.openstreetmap.org/way/428294122 with
Lane specsWhat's in a lane spec? The A/B Street definition currently looks like this:
But I'd like to extend this to be more useful:
Unlike OSM, I don't want free-form tagging here. I want to define an explicit specification, so software like A/B Street can handle all cases captured in the spec. At the same time, I realize a schema could get complex very quick, so I want to strike some balance. So for instance, time restrictions might not make v1 of this schema. Alternatively, software consuming this API can just ignore things it doesn't care about. LocalizationThe function would probably also take in some kind of configuration, at least describing whether traffic drives on the left or right hand side, and things like if cyclists are generally allowed to use bus lanes. Only one way at a timeThis function would only look at a single way's tags. If a street car track, cyclepath, or footway are mapped as a separate way that's parallel or partly overlapping, this API wouldn't try to handle any of that. Only what can be inferred from the given way's tags. Assuming defaults?For the A/B Street use case, I want widths of each lane. Usually that's not explicitly tagged, but sometimes it is (the Berlin community has been doing an awesome micromapping effort here). One option is that the API makes reasonable guesses (perhaps driven by the localization config passed in) about lane widths. The other is that unknown information is just omitted / indicated as missing in the output. |
Beta Was this translation helpful? Give feedback.
-
ImplementationOutputThe easy answer is JSON, probably with a schema. Alternatively, we could use protocol buffers or something similar with cross-language support. Language(s)I have an initial implementation of this API: https://github.com/a-b-street/abstreet/blob/master/map_model/src/make/initial/lane_specs.rs But I think having multiple implementations in different languages would be fine too. The Rust implementation doesn't use any language features that should be surprising, but getting the development environment set up could still be a barrier to people. I think maintaining an implementation in multiple languages should not be too tedious, because the code structure is straightforward to port. And because of testing -- see below. TestsEven if we didn't want to share an implementation, I'd at least like to share a set of test cases to agree on the transformation process. I have some examples written: Each test case would list the OSM key/values, then the expected lane spec output. The test cases could be checked in as a JSON file in a git repo somewhere, and any implementation could check itself against them. |
Beta Was this translation helpful? Give feedback.
-
GoalsWhy bother trying to share this kind of code and make a schema for lanes?
|
Beta Was this translation helpful? Give feedback.
-
I think the transformer code to create what you suggest would have value honestly outside this project if just to reference. I am interested in reviewing, but would have limited bandwidth to contribute. |
Beta Was this translation helpful? Give feedback.
-
Regarding Map Machine, it will be great to have such an API. I'm going to support lane tags but as for now, I've covered just lane number and lane widths. |
Beta Was this translation helpful? Give feedback.
-
FYI, there will be an update of the Straßenraumkarte by @SupaplexOSM soon and I am working on a (english) blogpost about the tagging involved. That will show some of the processing decisions Alex' made for displaying the lanes in all it's details. Current version at https://supaplexosm.github.io/strassenraumkarte-neukoelln/?map=micromap#20/52.47400/13.44061 |
Beta Was this translation helpful? Give feedback.
-
I think this would be a great first step. We can collect OSM Way data in a key-value (txt?) format and the desired JSON output next to it. A few complex situations from #789 (comment) come to mind, that will make for nice test cases. I am wondering …
|
Beta Was this translation helpful? Give feedback.
-
Right now, I am very interested in everything that helps explain and standardize the tagging. The actual shared lane "file" is less interesting for now, since we don't have any use cases for it yet. However, the two things can go hand in hand: If we where to process areas of OSM based on this schema and visualize it as a (vector tile) map, it would help a lot to improve the tagging in general (make things visible, showing interpreted data). Right now, a more pressing issue for me (for this general topic) is, to create something like https://streetmix.net/ which outputs OSM tagging recommendations. This would help a lot to get better tagging on the road. |
Beta Was this translation helpful? Give feedback.
-
I just ran across https://osm-tiles.james-ross.co.uk/?map=19/51.5050/-0.0899&layer=standard&layer=all again. A project by @twpol at https://github.com/twpol/osm-tiles. James, this discussion an the Repo at https://github.com/a-b-street/osm2lanes could also be interesting for you and your project. |
Beta Was this translation helpful? Give feedback.
-
One piece of the A/B Street importing process looks at an OSM way's tags and calculates a list of lanes in left-to-right order, with a few simple details about each lane. The idea has come up a few times to share this piece of code among other projects that also process lane-level details.
See the threads below for details (and feel free to start new sub-threads!). The main questions I have for the stakeholders listed below are:
Stakeholders:
Beta Was this translation helpful? Give feedback.
All reactions