osm-americana / openstreetmap-americana

A quintessentially American map style
https://americanamap.org
Creative Commons Zero v1.0 Universal
183 stars 59 forks source link

Exits to nowhere look weird #746

Open quincylvania opened 1 year ago

quincylvania commented 1 year ago

On/off ramps show up at zoom 9, but many of the roads they link to aren't visible yet. This leads to a "barbed wire" effect that doesn't look great.

Screenshot 2023-01-30 at 10 02 33 AM

A few options:

kennykb commented 1 year ago

This would surely have been easier if OSM had adopted the convention that link roads are tagged with the lower significance of the two roads that they connect. But that train surely left the station a long time ago.

ZeLonewolf commented 1 year ago

It's not hard to imagine why the convention evolved how it did- the early designers wanted the ramps to match stylistically with the higher-significance road. Unfortunately there's no tagging that could help us figure out, for a link, what class of road its connected to on the lower-significance side. And, I'm not smart enough to know how to do it in PostGIS.

I think perhaps the diamond markers might be the most workable way to deal with it at this middle zooms.

1ec5 commented 1 year ago

This would surely have been easier if OSM had adopted the convention that link roads are tagged with the lower significance of the two roads that they connect. But that train surely left the station a long time ago.

If I recall correctly, this convention didn’t receive very much discussion. Basically one mapper wrote up a wiki page that looked very authoritative, some mapping teams picked it up and ran with it, and it was eventually accepted as fact. But even mappers who generally went with the lower classification still usually made an exception for freeway and expressway ramps, which are physically more closely related to the freeway/expressway than the surface street.

Unfortunately there's no tagging that could help us figure out, for a link, what class of road its connected to on the lower-significance side. And, I'm not smart enough to know how to do it in PostGIS.

It would be easy to avoid the barbed-wire effect by hiding all link ways at low zoom levels, but the tradeoff is that there will be gaps at trumpet junctions between freeways.

I agree that postprocessing would be the way forward. For example, most routers have a step that decides whether a link road is a ramp or just a surface street’s turn channel based on the way’s length and shape. Valhalla additionally classifies ramps based on the classification of the road the ramp leads to.

We need to do postprocessing anyways to eliminate duplicate exit numbers; diamond markers can come along for the ride. If we were working with a GeoJSON source, we could probably get away with clustering, but clustering isn’t supported for vector layers: mapbox/mapbox-gl-js#10408.

zekefarwell commented 1 year ago

Could a postprocessing step do something like this? This would be only for low zoom tiles where showing link roads really doesn't make sense at all but we want to avoid gaps.

  1. Follow motorway_link & trunk_link segments in each direction until a different highway class is found.
  2. If the highway class on both ends is motorway, change the class of all the link segments to motorway.
  3. If the highway class on both ends is trunk or motorway on one side and trunk on the other, change the class of all the link segments to trunk.

By changing these link segments that connect only between motorway and trunk it would be possible to omit all link roads at a low zoom level with no gaps. The places where there would have been gaps would have had the link roads changed to their matching main highway class.

1ec5 commented 1 year ago

The concept seems reasonable to me, but I don’t know what the relevant portion of the codebase looks like. This issue is focused on freeways (highway=motorway), but an expressway can also end at a set of freeway-style ramps to other roads.

ZeLonewolf commented 1 year ago

I think @zekefarwell's algorithm is probably only reasonably doable in planetiler as Java code. I wouldn't even know where to begin to attempt that in SQL. So achievable but not until the next major release of OMT where we can do things in pure code.

1ec5 commented 1 year ago

I attempted to mitigate this issue in the AARoads Wiki fork by rendering freeway ramps more like surface streets than like the freeways they hang off of: https://github.com/aaroads-wiki/openstreetmap-americana/pull/2#issuecomment-1730544721. I tried to maintain a visual link between freeways at T-interchanges by making them slightly more prominent than surface streets and by keeping them visible at any zoom level in which freeways are visible. Unfortunately, the links are still severed at z8 because OpenMapTiles doesn’t include ramps at all at that zoom level.