Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Default speed limits via westnordost/osm-legal-default-speeds #244

Open
tordans opened this issue Aug 16, 2022 · 3 comments
Open

Default speed limits via westnordost/osm-legal-default-speeds #244

tordans opened this issue Aug 16, 2022 · 3 comments

Comments

@tordans
Copy link
Collaborator

tordans commented Aug 16, 2022

For those cases where no maxspeed is given, osm2lanes could test out https://github.com/westnordost/osm-legal-default-speeds to get a set of default speed limits per country.

Unfortunately that would only work if no maxspeed is given; otherwise osm2lanes would need to compare what is received (or interpreted) from OSM with what the library responds with and try to merge both, which I image would be hard given the complexity of the table that the library relies on.

@dabreegster
Copy link
Contributor

Thanks for forwarding!

If maxspeed is explicitly given, we could probably trust it. Maybe in the eventual web editor interface, we could warn if the tagged value disagrees significantly with the legal default.

We may have to figure out how to actually call this library, but it runs natively and on web, so it should be possible. Or maybe we just consume https://github.com/westnordost/osm-legal-default-speeds/blob/master/demo/distribution/legal_default_speeds.json (or rather, use the Python script to generate up-to-date values)

@westnordost
Copy link

Unfortunately that would only work if no maxspeed is given

Reverse search is implemented too:
https://westnordost.github.io/osm-legal-default-speeds/#tags=maxspeed%3D100&cc=DE

Or maybe we just consume https://github.com/westnordost/osm-legal-default-speeds/blob/master/demo/distribution/legal_default_speeds.json

So in other words, port the code that interprets that JSON (to Rust) (?)

Possible, it is about ~1000 lines of code (without test code).

About 700 lines of code is the parsing of the filter expression syntax as used in the second table on the wiki page, the rest is the matching logic.

However, the library should be callable from native code as Kotlin can be compiled to native. Though, I have never tried it and don't know what it would take to do that.

@dabreegster
Copy link
Contributor

However, the library should be callable from native code as Kotlin can be compiled to native. Though, I have never tried it and don't know what it would take to do that.

We'd also need to compile to WASM to run in web browsers, but this should work too. It's more a question of how much it complicates the build process to have non-Rust dependencies. I can investigate this when I find more time to focus on osm2lanes

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

No branches or pull requests

3 participants