Are from=* and to=* correct for road relations?

I’m trying to standardize tagging of roads in Morocco, starting with motorways.

Motorways don’t have actual names here, like you’d find in France or Spain (e.g. Autoroute du Nord, Autovia del Sur). They just have references and are called either by that (e.g. Autoroute A3) or by their origin and destination cities (e.g. Autoroute Casablanca-Agadir, see list of motorways on the operator’s website).

Now my question is, is it correct to use from=* and to=* on the respective relations (for the aformentioned examples, from=Casablanca, to=Agadir)? The wiki pages (from, to) are very unclear and say they’re for public transport and “recreational routes” (whatever that means).

If not, how can I precise this information? I feel like it has to be somewhere, and I don’t know if naming the relation Autoroute Casablanca-Agadir is the right way.

1 Like

Why do you need a relation? Just put ref=A3 on all the ways.

1 Like

Looking at the Combinations tab in Taginfo:

84% of route=bus have a “from” tag
22% of route=hiking have a “from” tag
6% of route=road have a “from” tag

So I think the wiki description is fair enough. In practice these different types of routes have different mapping conventions. For bus routes these tags are well established and often very important in differentiating between both directions of the same route. For hiking routes they are less widely used but still fairly common and may reflect a conventional order in which the route is described.

For road relations they are much less common, and likely to be less well supported by end user applications. But you could use e.g. Overpass to find examples of where it has been used. Being less common doesn’t automatically make it “incorrect”, but does suggest that not many mappers have seen a need for this information.

1 Like

Just like every other place in the world has relations for its motorways? To have a single element representing each motorway?

4 Likes

As long as you represent each direction of the highway route as a distinct route relation, each relation needs something to distinguish it from the opposite relation. In some countries, the directions are customarily identified by cardinal directions, which go in the direction=* key. Otherwise, some countries only identify the directions by terminus, hence from=* and to=*.

3 Likes

One feature, one OSM element, the ref belongs to the route, which contains many motorway segments. This is literally one of the reasons why relations were brought into existence in the first place.

2 Likes

Clearly my bad for not knowing. Not sure I’d bother with a relation but I can see others do and have for some time.

1 Like

If ref=* is only added to the relation and not the ways, will the road still be rendered like the image? If not then I don’t see the point in not adding ref=* to the ways, only to the relation. How would a user only looking at the map know which road is which?

It depends on the renderer. Some don’t bother with route relations at all, and some use only them for route route number display. My recollection is that OSM Carto is in the former category and OSM Americana in the latter. In this case the same data is on the way and in the relation, so both show the same.

If you’re from a country that has multiple highway routes over the same bit of road (like the US) then it’s easy to make the case for those as separate to the actual piece of road. If you’re from a country that doesn’t have multiple highway routes over the same bit of road (like the origininators of OSM in the UK) it’s easy to think “just tag the ref on the road”, since it genuinely is an attribute of the road there. Neither view is “entirely correct for the whole world”, hence the mix and match of tagging that we have now.

5 Likes

For now, it’s still recommended to put ref=* on ways in addition to creating the route relation, for legacy renderers that haven’t managed to update in the last 12 years.

Any country that has a bike route and a road route using the same pavement falls into the “like the US” category. This means you, too, UK.

Well not really - the bike route is absolutely a route, in that it several might use one stretch of physical road, but that’s not the case for “road routes”. There are people adding relations for those in the UK, but there are also people saying “what is the point of adding that?”.

Edited to add: I regularly fix bike and walking route relations when they break (and when the fix is obvious), and if a bus or road route relation has broken at the same time I’ll usually patch that up too. A bit of tolerance for “different people doing things different ways” goes a long way in OSM.

Sure, really! If you’re getting around by bicycle, a motorist-forward map is worthless, and road routes (outside unusual cases like Oregon where all road routes are also bicycle routes if not otherwise closely bypassed by a bicycle route) aren’t relevant. A bike route and a road route sharing the same way is still multiplexing routes. That’s the problem route relations solve.

As an example, this uses relations to show bike, horse and foot routes but ways for refs on roads.

Right, that’s good. Now let’s work towards sunsetting ref=* on ways already. It’s a dinosaur that shouldn’t have lived this long after relations were introduced.

2 Likes

The fine folks at SABRE are of the belief that this isn’t the case, and they’ve even found an exception to the rule, but our founders disagree. Anyways, the better half of this concurrency is in a relation, which is another solution to “just tag the ref on the road”, since road actually appears somewhere in that relation’s tags. :upside_down_face:

1 Like

I think that that is just a signage error. Everyone in the way history think that it is just the A40, and the OS agree.

The confusion may be partially because you have to “turn off the A40 to stay on it” a bit further on, when the road number changes.

1 Like

There have been real technical obstacles to handling highway routes in raster / mapnik based renderers in a way that’s compatible with minutely updates (see lengthy discussion here) - it’s not a case of simply “updating the renderer”.

These obstacles have reduced since OSM Carto migrated to osm2pgsql’s flex input, but somebody still needs to put in the work to get highway routes in the rendering database.

That’s separate from the issue of how best to support both relation and way based tagging, so I wouldn’t hold my breath.