Traffic Tracker efficiently allows you to factor commute time into your decision-making process by keeping track of the commute time for long-time period.
Traffic Tracker gathers real-time traffic data for the added route. It uses Google API to get the most recent changes in the traffic and commute time. By tracking traffic over long period of time (e.g. 3 months), you can see traffic patterns on the added route. Data analysis helps you to decrease the time spent in the traffic and find the convenient commute window.
To use this application, you'll need to take the following steps:
- Create a new, empty directory on your machine and
git init(or create an empty repo on Github and clone it to your local machine) - Run the following commands:
git remote add traffictracker https://github.com/kwegorek/traffictracker.git
git fetch traffictracker
git merge traffictracker/master
Why did we do that? Because every once in a while, traffictracker may
be updated with additional features or bug fixes, and you can easily
get those changes from now on by entering:
git fetch traffictracker
git merge traffictracker/master
Now that you've got the code, follow these steps to get acclimated:
npm install- Create two postgres databases (
traffictrackershould match thenameparameter inpackage.json):
createdb traffictracker
createdb traffictracker-test
- By default, running
npm testwill usetraffictracker-test, while regular development usestraffictracker - Create a file called
.envin the project root- This file is listed in
.gitignoreand put there your own API KEYS
- This file is listed in
GOOGLE_CLIENT_ID = 'hush hush'
GOOGLE_CLIENT_SECRET = 'pretty secret'
GOOGLE_CALLBACK = '/auth/google/callback'
GOOGLE_DISTANCE_API_KEY = 'YOUR_API_KEY'
Google place id geocoder: https://developers.google.com/maps/documentation/javascript/examples/places-placeid-geocoder
The Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations. The API returns information based on the recommended route between start and end points, as calculated by the Google Maps API, and consists of rows containing duration and distance values for each pair.
{ "destination_addresses": [ "Astoria, Queens, NY, USA" ], "origin_addresses": [ "Hoyt Ave S, Queens, NY 11102, USA" ], "rows": [ { "elements": [ { "distance": { "text": "1.1 km", "value": 1114 }, "duration": { "text": "5 mins", "value": 325 }, "duration_in_traffic": { "text": "6 mins", "value": 376 }, "status": "OK" } ] } ], "status": "OK" }
- To use OAuth with Google, complete the steps above with a real client
ID and client secret supplied from Google
- You can get them from the Google APIs dashboard.
Running npm run start-dev will make great things happen!
If you want to run the server and/or webpack separately, you can also
npm run start-server and npm run build-client.
For sequelize keep:
"pg": "^8.2.1",
"sequelize": "^5.21.13",
"sequelize-cli": "^5.5.1"