Giter VIP home page Giter VIP logo

vietbus's Introduction

VietBus

Introduction:

An implementation of A* algorithm for searching shortest and cheapest bus route in Hanoi, Vietnam.

Bus stop data is taken from OpenStreetMap.org, unfortunately, it only contains bus stops location (i.e. longitude, latitude) and bus route numbers in each stop. There is no bus route for us!

Problems:

  • Clustering bus stops base on number and location to build bus routes
  • Apply A* algorithm to bus stops and bus routes for finding optimal routes

Results:

  • Bus routes for all bus are built successful, with some limitations because of bad data:

    • Not all bus stops are marked in the map
    • Not all bus number are marked in all their stops
    • Data is out of date (most of them are updated in 2010)
  • A* search is implemented successful. Run smoothly (and somewhat slowly) in our bus stops and bus routes "bad" data.

Code:

Extract data

  • Extracting bus stops data from OSM file by parsing XML and save to JSON.

  • Source code.

Explore data

  • Using matplotlib for exploring data.

  • Clustering bus stops to build bus routes by nearest neighbor method and save results to JSON.

  • Source code.

Import data to MongoDB

  • Import results from 2 steps above to MongoDB for querying data.

  • Source code.

Build search models

  • Implementing A* class for graph (bus routes) and node (bus stops). Source code.

  • Searching from one bus stops to another to find optimal route and return GeoJSON data. Source code.

Build web app

  • The map is built by using Leaflet library

  • Input for start point and end point is taken from user using simple javascript

  • Main app take start, stop point infomation, querying MongoDB to find nearest bus stop, then excuting search using their IDs. GeoJSON output is rendered to the map.

How to run the app?

This app is built on top of Python 3.4. May or may not work with Python 2.x

  • Download or clone the source code, create virtualenv if necessary
  • Install packages using pip3 install -r requirements.txt
  • Install MongoDB server
  • Init database using python3 manage.py init_db
  • Run web app using python3 manage.py runserver
  • Go to http://0.0.0.0:5000 for finding bus!

How does it look?

Demo version: vietbus.herokuapp.com.

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.