Project

bahn.rb

0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Load connections for public transportation from the m.bahn.de website.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

>= 0

Runtime

 Project Readme

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 ;)