OpenStreetMap

eternaltyro's Diary

Recent diary entries

I was mapping public transport routes and stops waaay north in Chennai city when I noticed an existing stop that had local_ref=IIT. This rung so loud a bell in my head that I went to Overpass Turbo to dig up all nodes with that tag. Surprise, surprise..

Image of OverPass Turbo showing dozens of stops in Chennai city having local_ref=IIT

OverpassQL for downloading bus roads and bus stops data into JOSM

Posted by eternaltyro on 2 February 2022 in English (English). Last updated on 5 February 2022.

Background and context 🗺️

I’ve been using JOSM to map missing public transport routes in Chennai. It’s a project I’ve been doing for personal reasons which I intend to elaborate in another post and I began with iD only to find later that the order of the route segments matter and iD doesn’t make it easy to do reorder segments.

So I started using JOSM with a helper plugin I found. This has made my workflow much easier and faster. One small annoyance though is that I could only download a small section of a fairly large city to edit the map in JOSM. I discovered I could download larger areas if I carefully picked specific ways or nodes since the limitation (to downloading data) is the total size of data that OSM can return.

So I went and searched the web for examples of OverpassQL and their explanations, learned what I could about how the QL works in the time I had and strung together a quick and dirty query that downloads ONLY roads and bus stops within the bounding-box (that I get to easily draw in JOSM).

This probably could be improved for concision. This is the OverpassQL I use to download roads and existing relations in order for me to map bus routes using JOSM’s overpass-based data import dialogue window.


[out:xml][timeout:90][bbox:{{bbox}}];
(
  wr["highway"="primary"];
  wr["highway"="primary_link"];
  wr["highway"="secondary"];
  wr["highway"="secondary_link"];
  wr["highway"="tertiary"];
  wr["highway"="tertiary_link"];
  wr["highway"="trunk"];
  wr["highway"="trunk_link"];
  node["highway"="bus_stop"];
  node["bus"="yes"];
  node["public_transport"="platform"];
  node["public_transport"="stop_position"];
);
(._;>;);
out meta;

This has some nice conveniences for me:

  1. It does not download residential roads and therefore does not clutter the viewport
  2. Does not download railway lines
  3. I can download a fairly large area - usually the size of an entire city.
  4. I can do batch / scripted editing of bus stops to add tags (put down your pitchforks - I realized my mistakes early on and have stopped clobbering others’ work unless absolutely necessary)
  5. I can save my JOSM session and not have it eat up a lot of my disk space.

Explanation of the QL

  • nwr is short form for a combination of nodes, ways and relations. It’s basically an OR clause.
    • Other available combos are nw, nr, and wr.
    • Then of course, there are standalone keywords for node, way, and relation.
  • Wildcards are done by specifying just the key without the value: node["public_transport"]; matches all values for the key public_transport
  • Maybe I should add the PTv2 stop_area relation: relation["type"="public_transport"]["public_transport"="stop_area"]; to this code??
  • In the areas I edit, there are hardly any motorways so I don’t bother adding them unless I find a missing section.
    • I could add a wildcard for highways, but I don’t want the viewport cluttered, so..
  • ⚠️ The parentheses groups the queries, if you remove it, only results matching the last statement will be returned.

Notes:

The size on disk for an empty roads-and-bus-stops-only session is ~7 MiB for a city the size of Chennai which I’m editing currently. But there are not many routes or other relations mapped within the city. Even for a better mapped city like Bangalore or Delhi, I think the size on disk will not exceed ~10 MiB. Don’t quote me on that though.

OverpassQL documentation is not very friendly. Maybe there should be a page with a zillion examples of all combinations that can be written using this QL with explanations for each of them. I dream.

⚠️ I am probably missing deprecated tags for bus stop platforms🚉. But so far, I’m unaware of any.

Addendum1 (05 Feb 2022)

I realized I’m going to have to download relation data more carefully, meaning something like this:


[out:xml][timeout:90][bbox:{{bbox}}];
(
  ... snip ...
  relation["public_transport"="stop_area"];
  relation["route"="bus"];
  relation["route_master"="bus"];
);
(._;>;);
out meta;

I also realized that (quite late 😖) that I could take advantage of layers in JOSM. Downloading data as a new layer - and renaming it to my convenience - was the way to go. I could hide the layer if it ever gets in the way.

Original post made - 02 Feb 2022

Location: CMWSSB Division 60, Ward 60, Zone 5 Royapuram, Chennai, Chennai District, Tamil Nadu, 600001, India

Specs

Ministry of Road Transport and Highways (India) manuals for standards and specifications for four and six laning of national highways. As seen on National Highways Authority of India (NHAI) website

Specs for four-laning of national highways: Scanned PDF Link - 2.8MB

Specs for six-laning of national highways: Scanned PDF Link - 2.3MB

New NH numbering scheme

Department of Road Transport and Highways (DORTH) published a new numbering system for national highways: Scanned PDF document - 3.3MiB (28th April 2010)

The document reads in English from page #21.

Old numbers: Wikipedia Link

New numbers: Wikipedia Link

References

  1. Ministry of Road Transport and Highways (MORTH) - http://morth.nic.in
  2. Department of Road Transport and Highways (DORTH) - http://dorth.gov.in