Along a route.

Sept 1 2012

A quick project that I worked on at Code for America is RouteView. The idea came about while looking at the camera images in the city of Honolulu. Both the city's and the state's sites that featured camera images where complex, required many clicks and navigation to view all the cameras, and limited camera views by area, not route. When selecting a route to drive I simply care about the traffic along the route, and how to adjust my route.


RouteView uses a dataset of locations of all the traffic cameras on the island, and after querying Google's Map API for directions between 2 points, loops through the cameras, checking for distance from the route line.

You'll need to include the geometry library when you add the Google Maps API:

<script type="text/javascript"

Using the isLocationOnEdge function of the geometry library. You just pass the Point, the Line and the Tolerance. It returns a Boolean.

google.maps.geometry.poly.isLocationOnEdge(latLng, polyline, 0.00025)

Finally RouteView takes the cameras that were within the threshold and orders them based on distance from the starting point. It uses that sorted list to show the camera images in an ordered list.

It's a really simple app, and available here on github