Repository navigation
Move country handling into toll parser, change default from MISSING to NO - #3111
Conversation
| break; | ||
| } | ||
| case BIH, GBR, IRL, MDA, MKD, MNE, NOR, RUS: { | ||
| // todonow: missing remains missing? |
There was a problem hiding this comment.
The general idea is to modify the toll value if we can classify it based on the country/highway combination. There are a few countries that have a slightly more complicated set of rules that prevent us from coming up with a workable fallback. For those, we have to stick with MISSING to express "we don't know".
e.g.:
- BIH, GBR, IRL, MKD, MNE, RUS -> toll only applies to selected parts of the road network
- MDA, NOR -> toll only applies to foreign vehicles
There was a problem hiding this comment.
Apparently there is no general toll in Great Britain, but only for certain roads, bridges and tunnels. like the longest motorway M6 (which strangely does not have a toll tag in OSM, for example here). Like for example a relatively short section of the M6 around Birmingham.
There is a general toll for HGV >= 12t for all M- and A-roads (A-roads seem to be tagged as trunks) source. Unfortunately, we do not have an enum value for >=12t vehicles only.
There was a problem hiding this comment.
You set Toll.NO for all roads in ALB, AND, FIN, FRO, GGY, GIB, IMN, ISL, JEY, MCO, MLT, SMR, UKR, VAT. Are these countries different to, say, some non-European countries, because for these we are (more) sure there is no toll? Or why did you use NO here, but MISSING in other cases. I understand that MISSING is meant to be used if our information is incomplete, but we like to allow users of the encoded value to distinguish missing information from explicit toll=no tags (or rules).
There was a problem hiding this comment.
There are a few countries that have a slightly more complicated set of rules that prevent us from coming up with a workable fallback. For those, we have to stick with MISSING to express "we don't know".
Do you have an example where replacing 'missing' with 'no' is really a problem? I think we could just use NO everywhere and where this isn't a good fit people could either improve OSM or add some more logic here.
There was a problem hiding this comment.
For those countries which generally don't collect any toll
You set Toll.NO for all roads in
ALB, AND, FIN, FRO, GGY, GIB, IMN, ISL, JEY, MCO, MLT, SMR, UKR, VAT. Are these countries different to, say, some non-European countries, because for these we are (more) sure there is no toll?
Exactly. At least from my last research, the end result for those was that none of them collect classic road tolls.
| RoadClass roadClass = RoadClass.find(readerWay.getTag("highway", "")); | ||
| if (roadClass == RoadClass.MOTORWAY || roadClass == RoadClass.TRUNK) | ||
| toll = Toll.ALL; | ||
| // todonow: why missing not no? |
There was a problem hiding this comment.
I don't understand why we set Toll.NO for all roads with missing toll tags for Albania, Andorra etc. (see above), but here we apply a default Toll.ALL for motorways+trunks while we keep Toll.MISSING for all the other roads. Related: #2450 (comment)
There was a problem hiding this comment.
I think NO should be a sensible fallback for other highway types.
| if (roadClass == RoadClass.MOTORWAY || roadClass == RoadClass.TRUNK) | ||
| toll = Toll.ALL; | ||
| else | ||
| // todonow: really? every road is a toll road for hgv? |
There was a problem hiding this comment.
Is this actually the case? (same for Liechtenstein)
There was a problem hiding this comment.
At least from what I could find online: yes. The OBU seems to count every kilometer driven in Switzerland and Liechtenstein as toll.
There was a problem hiding this comment.
Apparently yes, vehicles >= 3.5t need to pay the 'Schwerlastabgabe' for every kilometer in the entire road network.
|
|
||
| if (toll == Toll.MISSING) { | ||
| Country country = readerWay.getTag("country", Country.MISSING); | ||
| switch (country) { |
There was a problem hiding this comment.
Can we move this to a dedicated method?
Country country = readerWay.getTag("country", Country.MISSING);
toll = applyCountryDefaults(country, toll);This keeps the handleWayTags short and allows to get rid of all the break statements by using return instead.
Here I moved the country handling from the different country rules right into the toll parser. This makes the country rules for toll the default. We can probably do the same with the road access rules afterwards and remove the country rules altogether.