Giter VIP home page Giter VIP logo

busroutejs's Introduction

BusRouteJS

A JS rewrite of bus route finder.

Currently in preliminary development, so everything is subject to change without notice.

Demo

There's a demo here. You have to turn on touch event emulation on Chrome to access the modal screens.

Install

Clone the repo and run npm install.

API

Creating a new Router object and calling .findRoutes(from, to) where from is the source place ID and to is the destination place ID (both integers) will return an array of Javascript objects like this:

var router = new Router();
router.findRoutes(252, 235);

[
	{
		"from":"252",
		"routes":[
			{"routes":["1","2","4","5","6","19","20"],"distance":4144},
			{"routes":["26"],"distance":3347}
		],
		"changes":["53"],
		"to":"235",
		"distance":7491
	},
	{
		"from":"252",
		"routes":[
			{"routes":["1","2","4","5","6","19","20"],"distance":12324},
			{"routes":["12","13","14"],"distance":6661}
		],
		"changes":["39"],
		"to":"235",
		"distance":18985
	},
	{
		"from":"252",
		"routes":[
			{"routes":["1","2","4","5","6","19","20"],"distance":12936},
			{"routes":["12","13","14"],"distance":7273}
		],
		"changes":["38"],
		"to":"235",
		"distance":20209
	},
	...
]

The biggest improvement over the last (PHP) version is that it now handles similar (almost duplicate, but alternate - like Kottawa/Pettah and Homagama/Pettah) routes gracefully, and runs completely on the clientside, with big popping Google Maps to boot.

License

Released under a permissive MIT license.

busroutejs's People

Contributors

janithl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.