Home

Awesome

air

"air" is a project to visualize live air quality data provided by the Tokyo Metropolitan Government. The main components of the project are:

An instance of "air" is available at http://air.nullschool.net. It is currently hosted by Amazon Web Services and fronted by CloudFlare.

"air" is a personal project I've used to learn javascript, node.js, when.js, postgres, D3 and browser programming. Some of the design decisions were made simply to try something new (e.g., postgres). Undoubtedly, other decisions were made from a lack of experience. Feedback welcome!

building and launching

Clone the project and install libraries from npm:

npm install

NOTE: you will need libpq to build pg. The libpq library was installed automatically by postgres on Mac OS X but required separate installation on AWS.

Install postgres and create a database, something like:

CREATE DATABASE air
  WITH OWNER = postgres
       ENCODING = 'UTF8'
       TABLESPACE = pg_default
       LC_COLLATE = 'en_US.UTF-8'
       LC_CTYPE = 'en_US.UTF-8'
       CONNECTION LIMIT = -1;

Launch the server:

node server.js <port> <postgres-connection-string> <air-data-url>

Example:

node server.js 8080 postgres://postgres:12345@localhost:5432/air <air-data-url>

Finally, point the browser at the server:

http://localhost:8080

implementation notes

Building this project required solutions to some interesting problems. Here are a few:

inspiration

The awesome wind map at hint.fm provided the main inspiration for this project. And the very nice D3 tutorial Let's Make a Map showed how easy it was to get started.