In a world that is dominated by fast-food drive-thrus the experience of exploration on the open road has been lost. All of the unique restaurants of America have fallen to the waist side. There are many apps that show you better food options; however, none help plan out where to eat in respect to reaching the final destination.
What it does
dtour gives you control on the open road.
Leidos Smart City Challenge
Qualcomm Disrupt Challenge
How I built it
We started with the Google Maps Directions API v3 to display the initial route from start to destination. Each leg of the destination had a travel time which we summed over until we exceeded one of our target times. This is a good first step but in the case of a freeway this leg could be a huge region and wouldn't provide a good estimate. Once we knew which step our target time was on we found the average rate at which a vehicle would cover that leg by dividing distance by the travel time. Each step also has an encoded polyline (unicode pairs of latitudes and longitudes) which we decoded and then used the geolib package (basic geospatial operations) to estimate the distance between each of these pairs. Finally we summed the line up until we reach where we estimated the target time to be. This process was applied for a various number of times to fit each meal time. After finding these coordinates we plugged them into the Yelp api to find the best food along the route. Since we had so many API calls to make, we decided to use NodeJS for our backend allowing us to asynchronously call all these APIs at every point. Finally, to host our application we used IBM Bluemix for its ease and simplicity.
Challenges I ran into
Since this was our first time using NodeJS we ran into problems with organizing the asynchronous calls. One major problem involving asynchronous calls is filtering the restaurants based on if they are open when the users path comes near them. Yelp's API does not have the closing and opening times of the restaurant so after loading the list of 20 restaurants from each of the meal time locations, we would then run them through async.detectSeries through the Google Places API which has the businesses hours for most restaurants. The subsequent cascading of the returned restaurant was quite difficult to implement.
Accomplishments that I'm proud of
There were many tricky elements to this project namely, learning a new ecosystem and solving problems with asynchronous calls. We are both very proud to successfully launch our first node app that elegantly utilizes external api's.
What I learned
Large volumes of data can be extremely powerful when utilized correctly. Our project accessed only a fraction of what is possible and still achieved results. This is telling of the potential that data has on the making impactful change. This project has given us an appreciation for smart cities as well as a deeper understanding of asynchronous calls, Node.js and api functionalities.
What's next for dtour
Our future involves fun and necessary detours. Fun detours such as national parks and concerts help show the culture of an area and bring joy on sometimes long and tedious car rides. Necessary detours such as hotels and gas help make the car ride more efficient and less stressful as the user will be informed on the best (AKA cheapest) places to get gas and the most comfortable places to sleep after an tiring car ride.
We would also like to explore the social media aspect of saving and sharing dtour routes that users have taken. A mobile app would help facilitate this.