-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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
Showing
10 changed files
with
673 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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.