mapping OSM

Can you help us count the number of lanes?

Welcome to the Data Group! Here’s a simple task to get you started with Open Street Map (OSM). We’re going to go looking for any roads that don’t have an information tag to tell us how many lanes thay have. And then add that information by editing OSM.

Step 1: Sign up for a free OSM account at https://www.openstreetmap.org/user/new

Step 2: Overpass is a tool that lets us search for particular attributes within OSM. Open Overpass at http://overpass-turbo.eu/

Step 3: Chances are, you’ll be looking at a map of Rome. Head on over to Ottawa. You’re actually looking at an OSM map… not bad, eh?

Step 4: Delete the example code that is present in the default view, and paste this code into its place:

/*
Find highways with no number of lanes tags specified, excluding paths, cycleways and service roads
*/
[out:json][timeout:25];
// gather results
(
way["highway"][highway!~"^(footway|path|pedestrian|cycleway|service|steps|platform)$"][!"lanes"][!"lanes:forward"]({{bbox}});
);

 
// print results
out body;
>;
out skel qt;

Step 5: Hit the [Run] button in the top left of your screen (it’s okay, you can trust us). If it objects and says the query returned a lot of data, just abort and zoom in closer to query a smaller area. You should see a few roads (aka “ways”) that are now highlighted in blue. These are all the road ways that are missing the information about the number of lanes they have. Optional fiddling with the view settings: You’ll most likely also see some circles; let’s get rid of those. Click on [Settings], expand the [Map] menu, and select “Don’t display small features as POIs“, then hit [Save]. The next time you run your Overpass query, those circles will display as lines. Do that now, if you like, by just hitting [Run] again.

mapping overpass

Step 6: Pick one of these road ways by clicking on it; it will turn red and show you a pop-up with more information.

Step 7: Click on the blue ID# of the way (394511545 in this case). This will open a new window in your browser, ready to make an OSM edit.

Step 8: Up in the top left, select [Edit], and then select “Edit with iD“. Your target way should still be highlighted. You now need to add a new tag for the number of lanes. Hit that [+] button circled in red as in the screenshot image below (make sure you’re choosing the button in the”tags” section, not the “relations” section), and now you’ll be able to add a new tag to this way. Type “lanes” in the text box at the bottom left of the table of tags.

mapping OSM

Step 9: So, how many lanes are there? In the box immediately to the right of the box where you typed “lanes”, you’ll need to provide a number as an answer. How to figure it out:

  • IMPORTANT: Make sure the segment you have selected has the same number of lanes along its entire length. If something changes along the way, the way will need to be split into pieces where this attribute changes. If you don’t want to get into splitting stuff, that’s okay, just choose an easier segment to edit.
  • For most residential streets, the answer is “2” (one lane in each direction). If there are 2 lanes going each direction, say “4”. Turn lanes also count as a lane in the total.
  • Sometimes, the satellite view will tell you all you need to know.
  • Or you can get a street-level view using a site like https://www.mapillary.com/.
  • In fact, Mapillary images are one of the pieces of “map data” you can view in this window: just hit [f] on your keyboard, and select Mapillary from the menu that pops up.
  • Look at how other similar streets nearby are tagged
  • Consult the OSM wiki on lane tagging for even more detail… see that ‘i’ icon by the trashcan icon? It will take you right to the wiki, here: https://wiki.openstreetmap.org/wiki/Key:lanes

Step 10: You’re almost done! Now just hit that [upload/save] button at the top of the screen near the middle. Type a brief note in the changeset comments to let others know you added the lanes tag. Upload (no need to have your changes reviewed if you feel confident), and you’re done! You just edited OSM.

These OSM edits are going to help Bike Ottawa generate a level of traffic stress map for Ottawa, and this will feed in to our advocacy efforts. Thanks for your contribution! If you’d like to get more involved in the Data Group by signing up to our mailing list and coming out to future meetings, send an email to data@bikeottawa.ca