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

Fernando Pacheco fernando.pacheco at ingesur.com.uy
Tue Mar 10 09:31:04 UTC 2015

```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
>>
>> 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

--
Ing. Fernando Pacheco M.S.L.

Ingesur srl
Dirección: Reconquista 268 apto. 511, Montevideo, Uruguay.
Teléfonos: +598 29161459, +598 99627932
Web: http://www.ingesur.com.uy/

```