Skip to content

Instantly share code, notes, and snippets.

@jothirnadh
Last active February 24, 2016 08:57
Show Gist options
  • Save jothirnadh/5dee4accfbee5d9c8fb6 to your computer and use it in GitHub Desktop.
Save jothirnadh/5dee4accfbee5d9c8fb6 to your computer and use it in GitHub Desktop.
Complete mapping of a road

Mapping roads for navigational purpose

Roads:

Roads are the main map features that we use for rendering navigational applications. Accurate roads representation leads not only to the well-looking map but also to a more precise navigation.

For now, most common approach for road mapping is to trace roads following their centroid. This way of tracing looks good for 2-lanes roads like unclassified and residential roads or for tracing over low-res imagery.

road with two lanes

What is a Way:

A Way in OSM represents road as a complex feature. First of all, it is a line that represents an object (road), which covers a specific area on the ground. In order to show the shape and contours of the road we may to draw a polygon and mark it accordingly. (See area:highway=*, description and comprehensive mapping guide in Wiki OSM)

What is a lane:

To understand the complexity of a Way, the widht of the road in divided into absolute (meters) or in relative number of lanes units of measurement. Numbers of lanes on the road will help us to make our driving decisions. At least road has one lane for driving in both directions. This is a rough assumption. As a general rule, the road has two or more lanes for vehicular traffic.

Use the lanes=* key to tag how many full-width traffic lanes there are on a highway.

Roads with more than two lanes

There are two cases:

  • Roads which carry traffic in both directions and

    simple road

  • Dual carriageway roads.

    dual carriageways

To set number of lanes for roads which carry traffic in both directions use :backward and :forward suffixes

Forward means the direction in which the way is drawn in OpenStreetMap, while backward means the opposite direction.

Example:
  highway=tertiary
  lanes=5
  lanes:forward=3   
  lanes:backward=2

Roads with an even number of lanes tend to have an equal number of lanes in each direction by default and thus we may omit :forward and :backward tagging.

In opposite case, when numbers of lanes for each directions don't match, we have to explicitly denote their numbers with lanes:forward=*+lanes:backward=* along with overall numbers of lanes=*.

We are not aable to draw a road on its center line, especially if roads join/fork or the number of lanes change. Imagine two roads which join: how would you draw the OSM-way around the point where the roads join?

center line

center line tracing

main direction

tracing main direction

Our decision is to trace main direction!

Before tracing (fix previous tracing), we need to inspect the strat and end points of the road segments. We need to identify the road direction, general numbers of lanes and the places where there are extra lanes. Based on this we choose our strategy.

Bidirectional roads

At the image below general number of lanes is two - lanes=2. Orange line is the center line of bidirectional way which represents main movement direction. We don't change its flow when extra lanes are appeared. Just set lanes=3+lanes:forward=2+lanes:backward=1 tags for the segment at right low corner with extra lane for turn to right. Optionally we may specify placement of the lanes relatively to the our OSM-way.

image

Look to the below image. There is we have two tagging variants:

  1. lanes=2 - 1 lane for each direction, or
  2. lanes=3 - denote middle lane for left turn as: point_left: this is discussed
highway=residential
lanes=3
lanes:forward=1
lanes:backward=1
lanes:both_ways=1
turn:lanes:both_ways=left

image

Case when number of lanes is even but numbers of lanes for each direction not equal. image

Dual carriageway roads

Trace ways for dual carriageways road for each direction as close as possible to their outermost edge. There is some reasons for such way of tracing:

  • In lower zoom levels we will be able to distinguish dual carriageways road from bidirectional one just glimpsing on the map
  • GPS devices will associate their position with right road segments even in bad signal reception conditions
  • Link roads which join to or fork from main highway will look good and will be connected in right places
  • We are able to adjust position of the lanes on the road using placement=right_of:3 tagging if needed.

Place nodes of the lines in each direction, opposite to each other, which will get a good view of the road on the map image

What is a turn lane:

A turn lane is an auxiliary lane demarcated on the road to specify directions to ongoing vehicles. Turn lanes serve two purposes:

  • Provide directional information to the ongoing vehicles and
  • Provide the lane information to be choosen for the vehicles changing their direction

Types of turn lanes

There are a total of 12 different turn lanes demarcated on the roads. They are:

Turn Lane Representation
left left
right right
through through
left_through through left
right_through through_right
left_through_right leftthroughright
left_right left_right
slight_left slightleft
slight_right slightright
merge_to_left merge to left
merge_to_right fahrbahn_2
bothways turn lanes both ways

Pre-requirements for mapping a turn lane in JOSM:

Before mapping turn lanes activate the following preferences in JOSM to visualize the mapped turn lanes: preferences > Map Settings

  • Map Paint Styles > Lane and road attributes

lane and road attributes5

  • Tagging Presets > lane attributes

taggingpresets22

  • Filter out non road features with inverse filter: boundary: | leisure: | landuse: | waterway: | amenity: | natural: | building:

Mapping a turn lane

  • Check all roads in the imagery for turn lanes at junction points

  • Split the road into segments based on the total number of lanes for the segment

  • For each road segment tag the turn lanes based on the road markings in the direction of the way. Eg. turn:lanes=left|left;through|through. Check OSM turn:lanes for reference.

oneway_turnlane

  • For bi-directional segments, use turn:lanes:backward= and turn:lanes:forward= to specify turn lanes in each direction.

biirectional29

  • Verify correct tagging using the Lane attributes style

lane attributes

Different scenarios we came across while mapping

1. Counting number of turn lanes:

If there are no clear cut demarcations on the road and yet cars are parked on either sides of the road, consider them as drive lanes. Case below:

screen shot 2016-02-18 at 5 10 10 pm

2. Parking lane issue:

In the U.S., when parallel parking spaces are marked, they are marked in one of three ways:

screen shot 2016-02-19 at 3 26 24 pm

Here’s an example of the box marking style:

boxes

3. Starting a turn lane:

Turn lanes should begin exactly as per the marking in the imagery, not before or after.

screen shot 2016-02-17 at 6 25 09 pm

4. Ending a turn lane:

Turn lanes should terminate at the first highway junction after the start of the turn lane. screen shot 2016-02-18 at 5 42 12 pm

5. Turn lane forward

In case of bi-directional ways, the key turn:lanes:forward=* describes only the turning indications on the lanes in the same direction as the osm-way; while adding this we must view the road in the direction to the osm-way(on the direction where the osm-way arrow is pointing).

turn f16

6. Turn lane backward

In case of bi-directional ways, the key turn:lanes:backward=* describes only the turning indications on the lanes in the opposite direction as the osm-way; while adding this we must view the road in the oppoiste direction to the osm-way(opposite to direction where the osm-way arrow is pointing).

turn backward14 *Adding a turn:lanes:backward tag

HOV is a symbol demorcated on major roads generally used to indicate vehicle occupancy requirements.

java openstreetmap editor 2016-01-25 20-35-24

In the above cases tag given to the road are hov:lanes=designated|yes|yes|yes

8. Bicycle lanes and road shoulders:

Road shoulders and bicycle lanes are ignored from the lane count. Both these roads are lanes=2

screenshot 2015-12-10 17 35 07

bicycle_lanes lanes=3 for the above example, ignoring the two cycle ways

  • Ignore bicycle lanes even though they are in the middle;example below:

68d49646-c3a4-11e5-807e-c7b118dd34bd

The middle way is also a biclcle lane which is not counted while adding the lanes tag

  • Additionally, Strava global-heat cycle layer can used to verify if a particular lane is a cycle-way. tms[16]:http://globalheat.strava.com/tiles/cycling/color3/{zoom}/{x}/{y}.png

9. Lane marked as a separate way

Do not add turn lanes in these cases where the only turn lane is already a mapped as a separate way.

9e4a470a-9f62-11e5-83ac-920ac6181842

10. Bidirectional turn lanes:

These are the lanes marked with symbol representing both directions at a time. screen shot 2016-01-28 at 4 47 52 pm

Tag used for such lanes are turn:lanes:both_ways=*

11. Mapillary Plugin to verify turn lanes:

The imagery at some places is not very clear and at-times the turn-lanes are covered by cars. In situations like these Mapillary plugin can be used. If there is Mapillary imagery coverage in that area, they can used to verify the presence of turn-lanes.

Name of the plugin: Mapillary

turnlanes_mapillary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment