KMB has a website and mobile application to track bus arrival time. We can improve it by digest such data and visualize it on a map, such that we can see the overall traffic status. Note that we shall not be bounded to KMB, the system should accept other data source as well, and we are not limited to show bus.
The goal of this project is to make a portal / platform which fetch data from KMB and process it such that we can estimate buses location and display on Google Map. The bus location should be update and it looks like real time traffic monitor. As there are about 3920 buses on KMB, we usually don’t display all buses at once (but it looks so fun), we shall provide a filter mechanic on the platform.
The platform consist of the follow servers, which can be installed on standalone machine or just colocated.
- MySQL
- Data Grabber and Processor
- Portal
- Install MySQL Server
> sudo apt-get install mysql-server
- Login mysql
mysql -u root -p
- Create database user
CREATE USER 'bususer'@'localhost' IDENTIFIED BY '1234';
CREATE USER 'bususer'@'%' IDENTIFIED BY '1234';
CREATE DATABASE busdb;
GRANT ALL ON busdb.* TO 'bususer'@'localhost'
GRANT ALL ON busdb.* TO 'bususer'@'%'
- Create Tables
Reference to database/create_table.txt
- Install store-procedures
Reference to database/sp_*.txt
- Install Node.JS 8
https://nodejs.org/en/download/package-manager/
- Install npm packages
> cd src
> npm install
- Adjust config.json if needed
- Update bus stop information
> cd src
> nodejs kmb_updateroute.js 12A
- Update arrival estimation
> cd src
> nodejs kmb_updateeta.js 12A
PS. You might want to setup cron job for this
- Install Node.JS 8
https://nodejs.org/en/download/package-manager/
- Install npm packages
> cd src
> npm install
NOTE: Adjust config.json if needed
> cd src
> nodejs portal.js
NOTE: As PoC the route is hardcoded on index.html