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

Stephen Woodbridge woodbri at swoodbridge.com
Tue Mar 10 14:18:23 UTC 2015


Here are some other oddities that are related to this problem:


In this example the route should be from green, yellow, to red. But in 
this case it appears to not honor the implied direction and reorders the 
points or it does a uturn at the yellow that is not noted in the 
directions. What the route should look like  is similar to this:


I have moved it over to the oneway streets to force the path. Or the 
path could like like this:


where it bypasses the red going the wrong direction, around the block to 
yellow then back to red.

This is a good application to see how OSRM responds to various route 
requests given different conditions.


On 3/10/2015 5:31 AM, Fernando Pacheco wrote:
> I understand the idea.
> I had imagined something similar but with existing spatial information
> and using OSRM directly.
> The definition of that stretch of the road goes from node i (OSM-Ni) to
> node j (OSM-Nj). The street is two-way. "A" is an intermediate point of
> my route (client). "a" is the nearest point of A on the street. The
> vehicles driven on the right side of the street.
>                           A
> OSM-Ni + --------------- a --------------- + OSM-Nj
> If A is the left side of the street: 1 - find the point nearest the
> street (a); 2 - add the node OSM-Nj (before node "a") to the route.
> OSM-Ni + --------------- a --------------- + OSM-Nj
>                           A
> If A is the right side of the street: 1 - find the point nearest the
> street (a); 2 - add the node OSM-Ni (before node "a") to the route.
> [The first point of the route should be approached in a similar way but
> the subsequent node is added after "a" (in flow direction).]
> Is this a possible approach to solve the problem with OSRM ?. Thank you
> very much. Fernando.
> El 09/03/15 a las 16:34, Stephen Woodbridge escribió:
>> 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
>> _______________________________________________
>> OSRM-talk mailing list
>> OSRM-talk at openstreetmap.org
>> https://lists.openstreetmap.org/listinfo/osrm-talk

More information about the OSRM-talk mailing list