User:Alv/Through

Here's a real world example. The purple dots represent the locations of the two traffic signs erected to prevent hgv's from using the residential road as a so called rat run, in either direction. Maybe the prison next to it has something to do with the restriction, too, and the fact that they would have a hard time navigating the narrow junctions. This is the normal practice in Finland (and other countries), to use signs as follows:

Entry forbidden for x +
"Applies to driving through (to street Y)"

All destinations along the red lines are legal destinations, only doing the full length is forbidden. However, the routes depicted by the blue lines lines are, even if not usually sensible for through traffic, totally allowed. In other areas, the blue lines can be sensible, or even the only possible routes.

The first pass solution years back was to set hgv=destination on the ways between A - B - C - D.

However (besides being inexact when some traffic on those roads is not limited by the signs), because of the way routing algorithms known to be in use work (note: algorithms, not any single software), this does not work. Anyone starting from the "Orioninkatu" street (in the middle, oneway towards south), would not get a route at all no matter what their destination were. (It's perfectly plausible for a routing task to start there, there's a kindergarten). For practical reasons, the tag value destination has been handled by routers so that such ways can only be the very first or the very last ways on any route; one can get "out" of a no through traffic area, and one can only drive into a no through traffic are, when their destination is within those streets. In this case, the routing would only construct a route start - B, check the next ways but fail when the destination tagged ways end.

For the same reason, tagging just the section B-C is not correct, and does not work, and not even C-D, nor A-B. And as an extra, note that A-B-C-G is an allowed route. Sometimes it is possible to find a single dividing point, where the destination tag "effectively" is, despite the signs being far away.

There's a small number of relations with the tags type=access + motor_vehicle=destination (or similar), and even fewer type=restriction + restriction:motor_vehicle=no_through_driving. With the latter kind, one would make three relations for this, with just the relevant ways near points A, D, and G included with suitable roles. Example:  3297476 (iD, JOSM, Potlatch2, history, analyze, manage, GPX, XML). A routing algorithm would then keep a list of relations, where it has first passed the from and some via ways, and only if they have been passed and it comes across the way in the role to in that relation, it would internally set the way as access=no. If the from and via ways were not already a part of the route, the restriction does not apply.