Distance Score

Technical Stack



AngularJS


Firebase.IO NoSQL Database AAS



Google Maps API


Google Distance
Matrix API

Background


Distance Score is a fully client-side application developed in AngularJS. It takes the simple question, "How will my commute costs differ depending on where I live?" and runs a not-so-simple matrix calculation based upon data from Google's Routing and Distance APIs. Distance Score takes advantage of its native client-side implementation to provide a fun and intuitive user experience. Once you give it a try, you might be wildly surprised at how much you are spending on your routine commute.

Screenshots

Result

DistanceScore is a superb example of what is possible for an all JS client-side application. It relies on absolutely 0 internal server dependencies. All data is accessed and stored using 3rd party APIs. This cutting edge front-end architecture allows for a UX that is unmatched by similar products on the market. Many fans exclaim, "I did not know this possible! Google should be offering this as a service!" when they first get the chance to use it.

Furthermore, the extremely lightweight design of a pure JS application is cheaper to maintain. It is hosted out of an S3 bucket for pennies. DistanceScore has inspired many additional geo-analytical project ideas and that I will build as time allows.

Noteworthy Technical Challenge:
Cutting Down on Repeat Google API Calls with Firebase

For any origin and destination pair, Distance Score needs a distance measurement for each of 4 different modes of transportation. While shopping for real estate, a user might have more than 10 origins and 5 destinations. This means the app will have to keep track of data for over 200 routes. Of course, Google rate limits its APIs. Given the ease that Distance Score allows a user to switch between origins, if DistanceScore had to hit the Google APIs every time an origin was switched the app would quickly surpass its rate limits and be throttled.

The solution to the rate limiting problem was caching using Firebase. Everytime a distance is calculated between an origin and a destination, that information is stored in Firebase's superfast NoSQL database. Whenever an origin is changed, DistanceScore first checks Firebase before Google's APIs. This keeps the API calls to the minimum and DistanceScore running smoothly.