OpenData - Cologne (KVB) bus and train stop geo coordinates

Today I played around with OpenStreetMap to get all geo locations for the stops of the cologne train and bus system. I needed those as preparation for the Advance Hackathon in April. To my surprise it was relatively easy to get those out of OSM.

If you want to grap some datapoints from OSM, you just have to follow these steps:

  1. Download the map data you need from Cloudmade or Geofabrik.
  2. Download osmosis
  3. Filter the needed data with osmosis.

To get the cologne train stops you need to start osmosis like this:

osmosis --read-xml nordrhein-westfalen.osm --bb left=6.7481 right=7.1322 top=51.8251 bottom=50.7633 --tf accept-nodes railway=tram_stop,station,halt --tf reject-ways --tf reject-relations --write-xml trainstop.osm

The bus stops can be collected like this:

osmosis --read-xml nordrhein-westfalen.osm --bb left=6.7481 right=7.1322 top=51.8251 bottom=50.7633 --tf accept-nodes highway=bus_stop --tf reject-ways --tf reject-relations --write-xml busstop.osm

After a little data parsing session I got the result I needed. All locations for all stops and their KVB-ID. You can use the KVB-ID on the KVB-Website to see detailed informations of that station. The URL for those look like this:

http://www.kvb-koeln.de/german/hst/overview/KVB-ID/

The data can be found in this git repo.

Portrait photo of Bodo Tasche
Bodo Tasche
Polyglot Developer

I am a freelance polyglot developer and love HTML5, testing, JavaScript, Ruby and Elixir. In the last 20 years I have been in lots of different roles, from Java to Elixir, from backend developer at a 3 people team in an early phase startup to the CTO of a web agency. Some of my work can be seen on my projects page.

Need help developing your MVP or to add new features into your current app? Need a CTO or a front/backend developer for hire? Send me an email.