Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for exits. #116

Merged
merged 2 commits into from
Jul 6, 2017
Merged

Add support for exits. #116

merged 2 commits into from
Jul 6, 2017

Conversation

willwhite
Copy link
Contributor

@willwhite willwhite commented Jul 5, 2017

This adds support for the upcoming exits support in OSRM. We are introducing "Take exit {exit}" text here but it's applied pretty narrowly right now - it is only used for off ramps that are tagged with exit information.

Fixes #114

},
"left": {
"default": "Take the ramp on the left",
"name": "Take the ramp on the left onto {way_name}",
"destination": "Take the ramp on the left towards {destination}"
"destination": "Take the ramp on the left towards {destination}",
"exit": "Take exit {exit} on the left",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm explicit about "on the left" here because left exits are more unusual.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is only true for right-hand driving countries. Ideally we'd have left-hand/right-hand driving country information here. This is ticketed upstream Project-OSRM/osrm-backend#2269, assuming it would also be exposed in the API responses.

For now, I would remove direction on ramps completely. (Take the ramp on the {left/right} -> Take the ramp)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, but I went in the other direction with 38c6630 and added specific instructions until we have enough information to simplify.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@freenerd just saw your note further down:

Decide on exit directions (i vote for remove left/right)

I learn toward more specificity here because it can be super jarring when there is a left exit and driver really do expect it to be specifically called out.

"destination": "Take the ramp towards {destination}"
"destination": "Take the ramp towards {destination}",
"exit": "Take exit {exit}",
"exit_destination": "Take exit {exit} towards {destination}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure about using an _ here style wise. There isn't a precedent for complex/multiple fields.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@daniel-j-h daniel-j-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this quick follow-up! I had a look and left some comments on the fixtures: some situations could benefit from adding the exit information in my opinion.

},
"instructions": {
"de": "180°-Wendung auf Way Name",
"en": "Make a U-turn onto Way Name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, thinking about situations for which a u-turn taking an exit occurs. As it's a complex maneuver for the driver do we really not want to add the exits information in addition here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exits only make sense in the off-ramp case as far as I know. I would be surprised if there are any tags used in other context, but I think we should focus on the highway/ramp use case first.

},
"instructions": {
"de": "180°-Wendung Richtung Destination 1",
"en": "Make a U-turn towards Destination 1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

"modifier": "left"
},
"name": "Way Name",
"exits": "4A,4B"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure when end-of-road can occur in combination with an exit - these may be good candidates for validation handlers? cc @MoKob

},
"instructions": {
"de": "Links halten an der Gabelung auf Way Name",
"en": "Keep left at the fork onto Way Name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we don't add the exit information here? I can see how the "keep left" and the exit information might seem redundant but wouldn't it be a confirmation for the user to take a specific exit while keeping left?

"modifier": "left"
},
"name": "Way Name",
"exits": "4A,4B"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a case for validation. cc @MoKob

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a merge and exit should ever be able to be in the same instruction.

},
"instructions": {
"de": "Links weiterfahren auf Way Name",
"en": "Continue left onto Way Name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no exit information here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use case for cars here would be to have an exit on/off a ferry? Not sure if these will ever be well tagged.

},
"instructions": {
"de": "Rampe auf der linken Seite nehmen auf Way Name",
"en": "Take exit 4A on the left",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exit information is only in english translation (yet?)

"exits": "4A,4B"
},
"instructions": {
"de": "Rampe nehmen auf Way Name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

German nitpick - are these really called "Rampe" and not rather "Ausfahrt"? cc @freenerd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving to #118

},
"instructions": {
"de": "In den Kreisverkehr fahren und auf Way Name verlassen",
"en": "Enter the rotary and exit onto Way Name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In complex roundabouts/rotaries/traffic circles it could make sense to add the exit information if we have it.

Copy link

@MoKob MoKob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to say that I am a bit concerned with adding so many fixtures for impossible combinations.

merge uturn for example would never be possible. Just like a fork sharp right or a new name uturn. Adding fixtures for these seems like a lot of adjustment that might come up later if we want to change wordings (related: https://github.com/mapbox/api-directions/issues/1053)

Also: I see that most of the advanced types we generate are treated just the same. E.g. new name, end of road ... are all announced as turns. If we don't expose any of these at all, we can switch to emitting only turn and ramps in the backend.

"exits": "4A,4B"
},
"instructions": {
"de": "Scharf links abbiegen an der Gabelung auf Way Name",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this type come out of the backend? I would hope not 😨

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that fork + sharp left should never occur?

"modifier": "left"
},
"name": "Way Name",
"exits": "4A,4B"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think a merge and exit should ever be able to be in the same instruction.

"exits": "4A,4B"
},
"instructions": {
"de": "In den Kreisverkehr fahren und erste Ausfahrt nehmen auf Way Name",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

German is kind of verbose on these. Wouldn't it be obvious to enter the roundabout? We could easily say Im Kreisverkehr die erste Ausfahrt auf Way Name nehmen, replacing In den fahren with Im.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving to #117

Copy link
Member

@freenerd freenerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the german-specific issues to own tickets #117 #118.

I have to say that I am a bit concerned with adding so many fixtures for impossible combinations.

@MoKob It feels like which combinations are possible is a moving target and we don't even have solid data on what can occur and what not. We therefore opted to include all combinations that could ever occur, even if some are potentially never going to come up.

I see that most of the advanced types we generate are treated just the same. E.g. new name, end of road ... are all announced as turns. If we don't expose any of these at all, we can switch to emitting only turn and ramps in the backend.

@MoKob even if they are not used in text instructions, they may still get dedicated turn symbols or different announcement patterns. Thus they make sense.

@willwhite PR generally looks good. Let me know if I should take on some of the

  • Decide on exit directions (i vote for remove left/right)
  • Add exit for more instruction types
  • Connect new strings in Transifex

"destination": "Take the ramp towards {destination}"
"destination": "Take the ramp towards {destination}",
"exit": "Take exit {exit}",
"exit_destination": "Take exit {exit} towards {destination}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

},
"left": {
"default": "Take the ramp on the left",
"name": "Take the ramp on the left onto {way_name}",
"destination": "Take the ramp on the left towards {destination}"
"destination": "Take the ramp on the left towards {destination}",
"exit": "Take exit {exit} on the left",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is only true for right-hand driving countries. Ideally we'd have left-hand/right-hand driving country information here. This is ticketed upstream Project-OSRM/osrm-backend#2269, assuming it would also be exposed in the API responses.

For now, I would remove direction on ramps completely. (Take the ramp on the {left/right} -> Take the ramp)

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to add the en.json to transifex, do some translations, then run the transifex script to pull the updated translations down again.

destinations: 'Destination 1,Destination 2',
exits: '4A,4B'
});
checkOrWrite(step, `${basePath}_exit_destination`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we only implement exits for off ramp right now, wouldn't we be okay with only fixtures for off ramp for now?

Or should we expose it for other types as well? @daniel-j-h noted the following:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with this approach because destination was the most obvious pattern to model this work off of. I also liked how the fixtures guarantee that exit information isn't being added to instructions where it shouldn't be. I'm open to other options, but seems like the additional fixtures are easy enough to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also lean away from implementing this for other types and just stay focused on off ramps, which will be 99% of cases.

"exits": "4A,4B"
},
"instructions": {
"de": "Scharf links abbiegen an der Gabelung auf Way Name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that fork + sharp left should never occur?

"exits": "4A,4B"
},
"instructions": {
"de": "In den Kreisverkehr fahren und erste Ausfahrt nehmen auf Way Name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving to #117

},
"instructions": {
"de": "Links weiterfahren auf Way Name",
"en": "Continue left onto Way Name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use case for cars here would be to have an exit on/off a ferry? Not sure if these will ever be well tagged.

"exits": "4A,4B"
},
"instructions": {
"de": "Rampe nehmen auf Way Name",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving to #118

@willwhite
Copy link
Contributor Author

willwhite commented Jul 6, 2017

Thanks for the feedback. I'm going to merge this into master so the new strings loaded into Transifex and we can get the ball rolling on translation but let me know if there are followup changes.

@1ec5
Copy link
Member

1ec5 commented Jul 6, 2017

Tracking a Swift port in Project-OSRM/osrm-text-instructions.swift#25.

@@ -254,7 +254,7 @@
"name": "Take the ramp on the right onto {way_name}",
"destination": "Take the ramp on the right towards {destination}",
"exit": "Take exit {exit}",
"exit_destination": "Take exit {exit} towards {destination}"
"exit_destination": "Take exit {exit} on the right towards {destination}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willwhite, if we’re saying “on the right” in the presence of a destination, why not also say “on the right” in the absence of a destination?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to remove the direction from instructions, except when we have no way/destination/exit at all: Take the ramp on the right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Fixed" this by removing the left/right indication in #124.

@freenerd
Copy link
Member

freenerd commented Jul 7, 2017

Released this as version v0.5.0 and pushed to osrm-frontend Project-OSRM/osrm-frontend#252

Here is a route with an exit instruction http://map.project-osrm.org/?z=16&center=36.090924%2C-95.999672&loc=36.089927%2C-95.993342&loc=36.088991%2C-96.004672&hl=en&alt=0

Note that this runs against the demo server with osrm-backend@master and we'll need to wait for osrm-backend@5.9.0 until this is available in a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants