Google Maps API - detect when crossing state lines and calculate distance travelled in each state -


i using google maps api calculate number of miles company's vehicles travel in each state on period of time. trips taken on period, user create routes on map, , program should able generate output like: 'maryland: 100 miles, virginia: 500 miles", etc.

i'm pretty sure can sending directionsservice request , iterating on response.routes[i].legs[i].steps[i].path array, unfortunately requires sending geocoder requests on thousands of latlngs, puts me on quota. there better way go this? need detect when route crosses state line , break separate routes, don't know how without iterating on path array.

if have 1000 elements in path array , binary searching (instead of iterating), should take 12 calls latlng determine path crosses border.

what sort of feedback when go on quota? if it's exception return, 3.5 second wait when receive quota pushback.


Comments