Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.21k stars 3.29k forks source link

Support different forward/backward ref values on edges #4590

Open danpat opened 6 years ago

danpat commented 6 years ago

We're adding support for cardinal directions on route relations for North American road networks.

However, single carriageway (non-divided) roads that belong to routes with cardinal directions require the ability to store different values depending on the direction of travel.

A simple example is this way: http://www.openstreetmap.org/way/490434780

This belongs to CA 74 West in one direction, and CA 74 East in the other. The way itself has a ref of CA 74.

There are more complex examples as well, where roads have completely different refs in each direction (ref:forward/ref:backward).

We should support edges that have different ref values in each direction - this would give us complete support for cardinal direction information in North America.

TheMarex commented 6 years ago

This is very simple and straight forward to implement:

  1. Add forward_ref and backward_ref here: https://github.com/Project-OSRM/osrm-backend/blob/master/include/extractor/extraction_way.hpp#L104 Technically we could do this with every string.
  2. Extend this check for parsed_way.forward_ref != parsed_way.backward_ref https://github.com/Project-OSRM/osrm-backend/blob/master/src/extractor/extractor_callbacks.cpp#L384
deniskoronchik commented 6 years ago

@TheMarex Hm, it's not simple as you wrote. Because in that case we should to store ref_forward and ref_backward in StringMap. In this case it's no data to make decision which one to get in https://github.com/Project-OSRM/osrm-backend/blob/master/src/util/name_table.cpp#L59

I don't fully understand how to pass it in that case to GetRefForID in DataFacade

MoKob commented 6 years ago

@deniskoronchik the problem you mention is related to https://github.com/Project-OSRM/osrm-backend/blob/456b198702ebade436203097bd77ebb6bd39f558/src/extractor/extractor_callbacks.cpp#L360-L364. You would need to generate a different name-id for both forward/backward edge if any of the name/pronunciations do not match in forward/backward direction.

The location @TheMarex is referring to would then be https://github.com/Project-OSRM/osrm-backend/blob/456b198702ebade436203097bd77ebb6bd39f558/src/extractor/extractor_callbacks.cpp#L384-L389 which would simply need to also compare the two name_ids.

The remaining work should simply be to change https://github.com/Project-OSRM/osrm-backend/blob/456b198702ebade436203097bd77ebb6bd39f558/src/extractor/extractor_callbacks.cpp#L427 and https://github.com/Project-OSRM/osrm-backend/blob/456b198702ebade436203097bd77ebb6bd39f558/src/extractor/extractor_callbacks.cpp#L394 to refer to the correct name_ids.

github-actions[bot] commented 2 weeks ago

This issue seems to be stale. It will be closed in 30 days if no further activity occurs.