Giter VIP home page Giter VIP logo

nyctrafficviz's Introduction

The Data Visualization of NYC Traffic

A Javascript (p5.js) project visualizes NYC Subway and Taxi data.

Data Source

Taxi Data

Due to the difficulties of getting realtime traffic data, we found an example from Deck.gl , which is a visual library made by Uber. One of the example recorded the route coordinates of the taxi in a certain time span. Accordingly, we took the data from the example to be our traffic data to represent the traffic speed.

  • The data is in trips.json

Subway Data

For the subway data, MTA provides realtime position data for all the trains. Unfortunately, it is not in JSON format. It is in a data format called GTFS instead. GTFS stands for_General Transit Feed Specification_, which is made by Google. It uses with protocol buffer to encode the data feed into a form that is even lighter than JSON format. We found a Python solution from GTFS Realtime Downloader that can decode the GTFS file into JSON format.

  • The train position data is in the folder 20171204_2100
  • Subway station position data is in Station.csv
  • Subway routes for every line is in shapes.txt and stops.txt

Implementation

SETUP

The first thing is to set the map. Our project uses Mapbox as the base, and we use Mappa.js to call Mapbox and connect it to p5. Next, load data for traffic, subway stations, subway routes, and subway GTFS data.

DATA ANALYSIS

  • To convert the raw data into class objects, I use some simple regular expression techniques to get and match what I want.
  • To find out the information from GTFS data, I create several hash tables to look up train id and route id.
  • Sort and trim the train data to make sure the chronological issues.
  • Sort and trim the route data to not drawing similar lines.
  • Calculate the moving speed of trains and taxis in each frame.

nyctrafficviz's People

Contributors

pondjames007 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.