Permalink
Browse files

Huge update:

- Migrate to Google Maps instead of Gothere, because there're bus stops in Johor
- Relayout everything
- Minified scripts
- Shows all routes passing through one bus stop
- Show bus stops on when zoomed further in
- Places search
  • Loading branch information...
cheeaun committed Jan 31, 2012
1 parent 4d50d4b commit 6fae653031fdf411b414d08e6eaa7d8614bbfc39
@@ -11,7 +11,15 @@ Here's how to get the data, assuming that you have `node` and checked out this r
cd data
./get-bus-services.js
./get-bus-routes-stops.js
./get-bus-stops-services.js

Then, load `index.html` in the browser. The map is powered by [Gothere Maps API](http://gothere.sg/api). Even the color scheme is inspired by Gothere. Tested to work great on latest Firefox and Chrome browsers.
The data you'll get are:

- `bus-services.json` - Lists all bus services with the bus numbers and `dir` (number of routes where 2 means two routes, usually in opposite direction).
- `bus-stops.json` - Lists all bus stops with coordinates and names.
- `bus-stops-services.json` - List all bus stops with the bus numbers/services that stops there.
- `services/{number}.json` - List two routes with all (polyline) coordinates and bus stops for each route. If the bus service doesn't have a second route, the second route data will be empty.

The map is powered by [Google Maps JavaScript API](http://code.google.com/apis/maps/documentation/javascript/). The color scheme and markers are *inspired* by [Gothere.sg](http://gothere.sg/). Tested to work great on latest Firefox and Chrome browsers.

If you have any feedback, tweet me at [@cheeaun](http://twitter.com/cheeaun).
@@ -1,7 +1,8 @@


//
// Generated on Tue Dec 06 2011 04:47:21 GMT-0500 (EST) by Nodejitsu, Inc (Using Codesurgeon).
// Version 1.0.7
// Generated on Tue Jan 31 2012 02:13:32 GMT+0000 (MPST) by Nodejitsu, Inc (Using Codesurgeon).
// Version 1.0.9
//

(function (exports) {
@@ -302,7 +303,7 @@ function paramifyString(str, params, mod) {
}
}
}
return mod === str ? "([a-zA-Z0-9-]+)" : mod;
return mod === str ? "([._a-zA-Z0-9-]+)" : mod;
}

function regifyString(str, params) {
@@ -403,8 +404,10 @@ Router.prototype.dispatch = function(method, path, callback) {
Router.prototype.invoke = function(fns, thisArg, callback) {
var self = this;
if (this.async) {
_asyncEverySeries(fns, function(fn, next) {
if (typeof fn == "function") {
_asyncEverySeries(fns, function apply(fn, next) {
if (Array.isArray(fn)) {
return _asyncEverySeries(fn, apply, next);
} else if (typeof fn == "function") {
fn.apply(thisArg, fns.captures.concat(next));
}
}, function() {
BIN +624 Bytes assets/dot-blue.png
Binary file not shown.
File renamed without changes.
BIN +623 Bytes assets/dot-red.png
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,40 @@
#!/usr/bin/env node

var fs = require('fs');

var json = fs.readFileSync('bus-services.json', 'ascii');
if (!json) console.log('bus-services.json not found');

var stops = {};

var data = JSON.parse(json);
for (var type in data){
var services = data[type];
services.forEach(function(service){
var no = service.no;
var json = fs.readFileSync('bus-services/' + no + '.json', 'ascii');
var d = JSON.parse(json);
var stops1 = d[1].stops;
stops1.forEach(function(stop){
if (stops[stop]){
if (stops[stop].indexOf(no) == -1) stops[stop].push(no);
} else {
stops[stop] = [no];
}
});
if (d[2] && d[2].stops && d[2].stops.length){
var stops2 = d[2].stops;
stops2.forEach(function(stop){
if (stops[stop]){
if (stops[stop].indexOf(no) == -1) stops[stop].push(no);
} else {
stops[stop] = [no];
}
});
}
});
}

fs.writeFile('bus-stops-services.json', JSON.stringify(stops), function(){
console.log('bus-stops-services.json created.');
});
Oops, something went wrong.

0 comments on commit 6fae653

Please sign in to comment.