Skip to content
fkwpPublic
forked from swoker/bahn.rb

About

Show public transportation options from the Deutsche Bahn

Resources

Stars

1 star

Watchers

2 watching

Forks

 
 

Latest commit

 

History

73 Commits

Folders and files

Repository files navigation

Load connections for public transportation from the m.bahn.de website.

This is under heavy development. Don't expect a working solution!

Example

require 'bahn.rb'

agent =  Bahn::Agent.new
routes = agent.get_routes(
	"Düsseldorf reisholz s bahn", 	# start address or station
	"Düsseldorf, Heerdter Sandberg 40 ",	# target address or station
	:include_coords => true, # include coordinates of stations
	:limit => 1,	# how many connections?
	:start_type => :station, # :station or :address
	:target_type => :address # :station or :address
	)
# output the connection info
routes.each {|route| route.parts.each {|part| puts part } }

# or with Geocoder
routes = agent.get_routes(
	Geocoder.search("Düsseldorf reisholz s bahn").first, 	# start address or station
	Geocoder.search("Düsseldorf, Heerdter Sandberg 40").first,	# target address or station
	:include_coords => true, # include coordinates of stations
	:limit => 1	# how many connections?
	# you don't need start- and target-type with geocoder :)
	)
# output the connection info
routes.each {|route| route.parts.each {|part| puts part } }

How to help

Feel free to implement some additions, refactor and create a pull request! ... and create tests of course ;)

About

Show public transportation options from the Deutsche Bahn

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages