U-Turns are not mentioned on the instructions steps

I’m using this service to provide directions. Many times, a u-turn is necessary in order to get where you’re going.

I can successfully get the route and the step-instructions, but for some reason, whenever there’s a u-turn, it’s not mentioned on the steps/instructions, even if the u-turn is properly drawn on the route:

These are the parameters I’m sending:
{“coordinates”:[[’ + start + ‘],[’ + end + ']],“roundabout_exits”:“true”}

and this is the URL:
https://api.openrouteservice.org/v2/directions/driving-car

uturn

For the image I’m attaching, these are the steps I’m getting:

-Head south on Avenida Líbano
-Continue straight onto Avenida Líbano
-Turn right onto Calle 1-H
-Enter the roundabout and take the 3rd exit onto Calle 19
-etc…

If someone would read those instructions, would get lost. There should be a make a u-turn instruction after the 1st item. I’ve tried to get it on different locations with the same result. This is a simple two way street where you need to make a u-turn to get where the destination is.

Is there something wrong with my request parameters? or do I need to specify somehow that u-turns must be mentioned?

Any help will be really appreciated.
Best regards!

Hey,

it’s hard to see what’s happening in these cases without the request details.
Could you share your start- and end point?

Best regards

It happens anywhere where a U-Turn is involved. Here are the coordinates for start and end points:

Start: -89.60929870605467,21.00990529379409
End: -89.59750645974535,21.019615780254412

And the first 2 steps I get are:

(Type: 11) Head south on Avenida Líbano
(Type: 6) Continue straight onto Avenida Líbano

I’ve read somewhere here, that the Type: 9 indicates a u-turn, and that’s the missing step that should be between the 1st and the 2nd step (the one I pointed with a red arrow on the attached image)

Any help will be really appreciated

Hi, just in case you didn’t get my previous answer (I don’t remember if I tagged you)

here are some other coordinates that you can use to test what I’m saying.

[[-75.30765367967103,39.984496906875016],[-75.30538989528604,39.98212110323286]]

You can paste them on the API Playground (Dashboard | ORS)

You’ll se that the route is drawn correctly, but the U-Turn won’t be mentioned on the instructions steps:

“type”:11,“instruction”:“Head southeast on Darby Road”
“type”:6,“instruction”:“Continue straight onto Darby Road”
“type”:10,“instruction”:“Arrive at Darby Road, on the right”

As you can see on this image, a U-Turn should be mentioned after the 1st instruction, otherwise, you’d get lost if you just follow these instructions.

uturn2

Is there any workaround for this?

Hi @sergiomng,

there is currently no workaround as it’s a bug that needs fixing.
It should return type 9 with something like “Make U-Turn onto Darby Road”.
Would you mind opening an issue in our repo for this with description?

Best regards

Ah, don’t bother. There’s already an existing one:

1 Like

Thanks for your answer. Would it help if I open an issue anyway? The one that you mentioned was posted 4 years ago, so it seems that they might need a little reminder :wink:

Please refrain from opening another issue. Instead, you could consider adding a comment with your example and description to the existing issue. Cheers!

1 Like

I’ve already got something working locally, if you want to test it out in a local installation:
in RouteResultBuilder.java:
add in getInstructionType

            case Instruction.U_TURN_LEFT, Instruction.U_TURN_RIGHT: 
                return InstructionType.UTURN;

& add || instrType == InstructionType.UTURN to isTurnInstruction

and in InstructionTranslator.java add in getTurnManeuver:

            case UTURN:
                return: 7;

Then you will still end up with something like:
“Turn U-Turn on road-name”

So it needs some extra handling translations for u-turns still to get something like
“Make U-Turn on road-name”
But i’m currently stuck on other tasks

Best regards

2 Likes

Thanks for your answer. I didn’t had it running locally, and it took me some time to be able to make it work.

I don’t know if I’m using the same version of ORS than you (v8.0.0), but I just wanted to be sure that this value is correct:

            case UTURN:
                return: 7;

The reason I’m asking is because on InstructionType.java, UTURN has a comment indicating that it’s value should be 9:

public enum InstructionType {
//Keep in sync with documentation: instruction-types.md
TURN_LEFT, /0/
TURN_RIGHT, /1/
TURN_SHARP_LEFT, /2/
TURN_SHARP_RIGHT, /3/
TURN_SLIGHT_LEFT, /4/
TURN_SLIGHT_RIGHT, /5/
CONTINUE, /6/
ENTER_ROUNDABOUT, /7/
EXIT_ROUNDABOUT, /8/
UTURN, /9/
FINISH, /10/
DEPART, /11/
KEEP_LEFT, /12/
KEEP_RIGHT, /13/
PT_ENTER, /14/
PT_TRANSFER, /15/
PT_EXIT, /16/
UNKNOWN /17/;

public boolean isSlightLeftOrRight() {
    return this == TURN_SLIGHT_RIGHT || this == TURN_SLIGHT_LEFT;
}

}

Also on instruction-types.md U-Turn has a value of 9

Value Encoding
0 Left
1 Right
2 Sharp left
3 Sharp right
4 Slight left
5 Slight right
6 Straight
7 Enter roundabout
8 Exit roundabout
9 U-turn
10 Goal
11 Depart
12 Keep left
13 Keep right

I could be wrong since I’m not familiar with this code, but I’d really appreciate your comments on this.

Best regards!!

            case UTURN:
                return: 7;

is correct.

1 Like