title: Google Maps API - detect when crossing state lines and calculate distance travelled in each state
body: <p>I am using google maps api to calculate the number of miles my company's vehicles travel in each state over a period of time.  For trips taken over the period, the user will create routes on the map, and the program should be able to generate some output like: 'Maryland: 100 miles, Virginia: 500 miles", etc.</p>
  
  <p>I'm pretty sure I can do it by sending a <code>DirectionsService</code> request and iterating over the <code>response.routes[i].legs[i].steps[i].path</code> array, but unfortunately this requires sending <code>Geocoder</code> requests on thousands of <code>LatLng</code>s, which quickly puts me over my quota.  Is there a better way to go about this?  I really only need to detect when the route crosses a state line and break it into separate routes, but I don't know how I would do that without iterating over the <code>path</code> array.</p>