Turn restrictions, like No left turn
and No U turn
, regulate traffic flow at intersections and accurately mapping them is critical to calculating valid routes on a map. The Mapbox Directions API uses OpenStreetMap which means you can easily update turn restrictions yourself — here’s how.
No right turn sign. Photo: pdd.ua
Turn restrictions in San Francisco (fullscreen map).
You can edit turn restrictions on OpenStreetMap with both the built in iD editor or the desktop based Java OpenStreetMap editor (JOSM). We’ve already covered mapping turn restrictions with iD so I’ll focus on JOSM here.
Mapping turn restrictions with JOSM
Consider a scenario where there is No Left turn
allowed from North Beverly Drive to Dayton Way
1. Install plugin
To get started in JOSM, download the turnrestriction
plugin in Preferences > Plugins.
Installing the turn restrictions plugin.
2. Select ways
Next, select the ways involved in the turn restriction: North Beverly Drive
and Dayton Way
.
- Split the road at the node where the turn-restriction will be added.
- The selection order of the ways is important in order to determine the type of restriction. Select
North Beverly Drive (from)
thennode at intersection (via)
thenDayton Way (to)
.
3. Select type of restriction
Finally, select the type of turn restriction to add. The plugin will detect the most appropriate restriction based on the order of ways selected. Done!
Behind the scenes, this applies the appropriate relations and tags that compose the turn restriction. Read more on how turn restrictions are modeled and how to add complex attributes like temporal restrictions on the OpenStreetMap wiki.
Adding a turn restriction using the turn-restriction plugin: select ways, then select type of restriction.
Here’s an overview of some of the tag combinations describing turn restrictions in OpenStreetMap:
Symbol | Description | OpenStreetMap Tag |
---|---|---|
No straight through | restriction=no_straight_on | |
No Right Turn | restriction=no_right_turn | |
No Left Turn | restriction=no_right_turn | |
No Turns | restriction=only_straight_on | |
No U-turn | restriction=no_u_turn | |
No Left or U-turn | restriction=no_right_turn;restriction=no_u_turn |
Join mapping!
We’re adding hundreds of turn restrictions in San Francisco, Boston and Washington DC using Mapillary, Improve-OpenStreetMap and telemetry data. You can join our work directly on Github and if you have questions or more ideas for mapping turn restrictions, find me on twitter.