I'm using overpass (the python wrapper overpy) to get bus stops in an arbitrary bounding box (i.e., any city) in Europe, and I was wondering which tags I can most consistently expect to be present - i.e., which query I should use.

The reason I'm asking: I noticed a large variation in the number of results, even within countries. In my case, the query node["public_transport"="platform"]["bus"="yes"] returns hundreds of results in Hamburg, but only 5 (long-haul only) in Berlin.

1 Answer 1


Summary: it seems (A) node["highway"="bus_stop"] yields almost consistently more results. I wrote a small script to compare the number of results of this query, with that of (B) node["public_transport"="platform"]["bus"="yes"] for several European capitals.

enter image description here

As can be seen, there are many cities which have many more results for query A.

Only Reykjavik seems to have things reversed:

enter image description here

For those interested, here is the script:

import pandas as pd
import numpy as np
import json
import overpy

api = overpy.Overpass()

def count_results(query, bbox):
    return {'A': len(api.query(f'node["highway"="bus_stop"]{bbox};out;').nodes),
            'B': len(api.query(f'node["public_transport"="platform"]["bus"="yes"]{bbox};out;').nodes)}

with open('country-capitals.json', 'r') as f: #source: http://techslides.com/demos/country-capitals.json
    countries = json.load(f)
cities = {d['CapitalName']:(float(d['CapitalLatitude']), float(d['CapitalLongitude'])) for d in countries if d['ContinentName']=='Europe'}
bboxes = {k: (v[0]-0.1,v[1]-0.1,v[0]+0.1,v[1]+0.1) for k, v in cities.items()}
counts = {k: count_results(bbox) for k, bbox in bboxes.items()}
df = pd.DataFrame(counts).T
df['A-B'] = df.A - df.B

I'm assuming that more results means better results, but judging from a few samples, that seems to hold.

To check if there aren't any better ways to find bus stop nodes, I checked to see, which tags are set in the results of A. I didn't check the values for the tags; just the fraction of results that have a value for a given tag.

Here are the results:

enter image description here

The only tag that is consistently set, is name, which is of no use.

So, A seems to be the best way. It is unfortunately not truly universal, but still A is much better than B in our sample of cities, as only for Reykjavik its results are worse.

Hope that helps.


I've gone and found a dataset with cities by population, and done the same procedure on the largest 300 of them (the cutoff is about 1.5M population). The conclusion above seems to hold, with all cities having more results with query A; in the 3 that have less, the difference is negligible.

df.sort_values(by='A-B', ascending=False)

           city  city_ascii      lat  ...     A     B   A-B
43     Santiago    Santiago -33.4500  ...  6999   553  6446
25       London      London  51.5000  ...  6251  1391  4860
177  Birmingham  Birmingham  52.4750  ...  4613    74  4539
20        Seoul       Seoul  37.5663  ...  4800   287  4513
61       Boston      Boston  42.3188  ...  4326   300  4026
..          ...         ...      ...  ...   ...   ...   ...
274      Handan      Handan  36.5800  ...     0     0     0
260      Daqing      Daqing  46.5800  ...     0     0     0
245    Brussels    Brussels  50.8333  ...  2415  2417    -2
5         Delhi       Delhi  28.6700  ...   849   855    -6
265      Suzhou      Suzhou  31.3005  ...  1093  1108   -15

Still, about 1/3 of the cities in our list have less than 100 bus stops in the 0.2x0.2deg rectangle bounding box around their center. That seems very few for such large cities, even if some of them are in developing countries and might principally have informal public transport. (I'm assuming the lat/lon coordinates in the file are correct.)

In conclusion, use query A, but keep an eye on your data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.