[OSRM-talk] arrive to destination on the adequate side in two-way streets

Stephen Woodbridge woodbri at swoodbridge.com
Mon Mar 9 19:34:38 UTC 2015


On 3/9/2015 1:54 PM, Fernando Pacheco wrote:
> Hi all.
>
> We are developing an application for routing solid waste collection
> trucks. We use OSRM to calculate distances between collecting points
> (intermediate points).
>
> Some customers are located in two-way streets (simple, no separators)
> ... How can I say to OSRM that must arrive to the collecting points at
> the adequate side of the street? That is, on the side where the client
> is, without crossing the opposite direction of the street to access the
> load.
>
> Is it possible?. Thanks in advance. Fernando.
>

Hi Fernando,

When the street is represented as a single street center line, a via 
point is just located on the street segment and then the route is 
computed to that point. I do not believe there is any way to say arrive 
at this node from a given direction.

One idea for a work around to this problem is to take advantage of the 
fact that OSRM does not make u-turns at via points so it might be 
possible if you know the location is on the right side of a street (in 
right side drive countries) and you can access the geometry to generate 
an additional via point before or after the collecting point and then 
include both points in order in the route.

so for a simple street:

         B                 A
-----------------------------------
      C                  D

with 4 collection points and you want to collect A and B only when 
traversing the street from right to left and C and D only when 
traversing the street from left to right. So if we add the lower case 
points a,b,c,d as:

         B  b              A  a
-----------------------------------
   c  C               d  D

Then we can compute a route from say Z (not shown) to A we would compute 
the route Z-a-A and this should force OSRM to arrive at A after point a 
and this would put it in the correct direction.

Say you want to route A to C then presumably you should be able to route 
a-A-c-C, this makes some presumptions that would need to be validated 
but the idea is that a-A forces the direction along the street for the 
start of the route, then it would have to exit the left end of the 
street and either make a u-turn or drive around a block and re-enter the 
street from the left to get to c then to C moving in the correct direction.

But as you can see this greatly complicates the problem by potentially 
doubling the number of nodes and requiring a lot of pre-computation to 
assess the side and direction.

-Steve W




More information about the OSRM-talk mailing list