-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add 20 mph roads to speed limit legend #177
Comments
I can run an Overpass query in a moment, but I'd be surprised if there are no roads in the UK in OSM tagged with anything other than those values. Why not bins? 0-20, 20-30, 30-40, 40+? |
We need to clean the OSM data into those allowed values. Why not bins? Because speed limits in the UK, like legally sold weights of bread and volumes of beer sold in pubs, can only be a small number of discrete sizes (400g or 800g for bread, fractions of pint for beer)! |
There is code in the openinfra project that takes the diversity of OSM tags and puts them into these categories. I can dig that out. |
Also, regarding less than 20, that's a valid point Dustin as there are some (mostly private?) roads with happily 5 mph limits so suggest
as an additional tag to account for that rare but helpful edge case. |
OK update here, the code from @hulsiejames is really clear happily. James if you want to jump in to help us at any point feel free, I imagine this will be converted into rock solid Rust code and implemented as a function, that could one day be split out as a stand-alone crate e.g. called (maxspeed == "national" & highway %in% c("motorway", "motorway_link")) ~ "70 mph",
# maxspeed == national, when NOT on motorway
(maxspeed == "national" & highway %!in% c("motorway", "motorway_link")) ~ "60 mph",
# maxspeed == national, when on standard (i.e Non-Residential) dual carriageway
# Default is 60 mph - if there is physical separation this is 70 mph, but
# assume that if there is separation then maxspeed tag = 70 mph. Rather be
# conservative stating 60 mph if not stated.
(maxspeed == "national" & highway %in% c("trunk", "trunk_link")) ~ "60 mph",
# Catch maxspeeds of 5, 10, 15 and set to 20 mph
maxspeed %in% c("5", "10", "15",
"5 mph", "10 mph", "15 mph") ~ "< 20 mph",
# maxspeed == (20|30|40|50|60|70 --> + mph)
maxspeed == "20" ~ "20 mph",
maxspeed == "30" ~ "30 mph",
maxspeed == "40" ~ "40 mph",
maxspeed == "50" ~ "50 mph",
maxspeed == "60" ~ "60 mph",
maxspeed == "70" ~ "70 mph",
# Already cleaned speeds (to stop mutate missing these)
maxspeed == "20 mph" ~ "20 mph",
maxspeed == "30 mph" ~ "30 mph",
maxspeed == "40 mph" ~ "40 mph",
maxspeed == "50 mph" ~ "50 mph",
maxspeed == "60 mph" ~ "60 mph",
maxspeed == "70 mph" ~ "70 mph", |
Government docs on speed limits, may be worth linking to this: https://www.gov.uk/speed-limits |
I didn't realise that 50 mph roads were legally defined a thing but they are. From previous link:
So maybe 60 mph+ should be 50 mph+? |
Another reason to change to discrete categories rather than bands: it matches LTN 1/20 guidance: |
First to answer the question of what's in OSM: try out https://overpass-turbo.eu/s/1v80. You can zoom anywhere and use a query like this: I agree that matching categories in guidance like LTN 120 is a good idea. So from the chart and observations about lower values, how about: <= 20, 30, 40, >=50? |
From my own intuition / experience as a cyclist and pedestrian, if I'm anywhere near 50mph traffic, 60 or 70 or 80 is just as bad. 50 is already way too scary. So the LTN 120 categories match my opinion there. |
Sounds reasonable but, due to the fact that we want to highlight places (often off the road network) that have below 20 mph limits I would suggest a "Less than 20 mph" category as James did for OpenInfra. Labels are important also, some people do not get inequality symbols. So I suggest: |
|
Will update the original post. |
A quick review of the openinfra code: https://github.com/udsleeds/openinfra/blob/3d2666d568a1ee50fb4fd7bf469b00d1f9398802/R/oi_clean_maxspeed_uk.R#L48 looks concerning. If the input is the raw string maxspeed from OSM, then a string like "30" means 30km, not mph. "30 mph" will be tagged explicitly. The rules it has about inferring untagged values look like a special case of something like https://github.com/westnordost/osm-legal-default-speeds. If we want to do something about the untagged data in the first cut, we can use a simpler UK-specific heuristic, instead of trying to integrate with this library in the next ~week. |
Yes simple rules can capture 90%+ of speed limits in most places so +1 to that. We can refine later but getting the majority of roads in a first pass sounds good to me. Any improvements on OpenInfra welcome, sharing in hope it's useful, not suggesting it's in any way complete or the last word on this. |
It may mean that to people writing OSM wikis but does it mean that to the OSM newcomer who is trying to tag a 30 mph road for the first time? |
OK but from memory there are quite a few erroneous "30" values in OSM for UK. We could set those to NA. Will be country specific for sure and my understanding, based on memories from OpenInfra project and conversations with @hulsiejames, who spent a fair amount of time looking at this, is that the vast majority of 30s should be switched to 30 mph. Is there a way to do that in bulk? I see three main options and it's worth thinking about pros and cons of each:
There may well be other options. Thoughts? |
Hi guys, happy to see some Openinfra being potentially useful as a start! This is an issue I thought whilst working on this. With a focus on UK infrastructure (whilst I was working on this). Here, I have made the assumption that if a user is trying to contribute OSM data, it's likely to be in the units of that countries speed limit (i.e. I wouldn't enter mph speed limits for European roads if mapping). I was considering adding some sort of spatial check for the infrastructure in question, attempting to locate the country it belongs to and infer units that way, but have been bogged down with TfN stuff. Though, as mentioned by Dustin, as an OSM data consumer following the wiki is a good idea given it is likely the best established tagging schema for OSM, and if a user has entered a speed tag incorrectly, could other parts of that contribution also be incorrect?
I believe this was the case which lead me to implement the change from 30 --> 30 mph (for UK analysis at least), though I will try and find my old notes. |
An advantage of setting speed limit to NA for "30": it could encourage people to fix the data upstream. Especially if there is a hyperlink to the relevant way in OSM. |
Here's a random example of I would vote in the short term to treating anything outside the explicit categories defined as an error. In the ATIP layer, we can just omit it and act like it's missing data. |
Fine by me and encourages improvements to OSM. Easy to add links to OSM ways in osm.org as bikedata does? Would be good to encourage people to look at and improve the raw OSM data. That's another issue though I think, albeit related. |
We can, but that's a UX question how, and adding the links would increase user-visible complexity, something I thought we were trying to minimize in #169. Should they be a more persistent tooltip when hovering on a road? Do we need to explain anything to people about how to edit OSM? I think for now, we should leave this alone, and come back to the question of having an ATIP mode specialized for helping people fix upstream OSM data. That's well out-of-scope for v2. |
Agreed. Will open an issue. |
Legend from video in #169 has speed as binned variable:
Given the importance of 20 mph zones, I think this should be a value in the legend. Also speed limits are discrete. So I would suggest the following categories for speed limits:
The text was updated successfully, but these errors were encountered: