I want to know how to开发者_高级运维 read the traffic information from google map as here in the following image. Google only displays the traffic layer by red, green, and yellow lines. But how can an application identify the color and find out how much traffic there is between source and destination.
Visually users can see with their eyes and identify the colors but what about the application?
Google Maps API does not expose traffic data. Your best bet is probably to find a different solution for your traffic data. Microsoft MapPoint might meet your needs.
UPDATES to answer questions in comments:
Whether there is a free service may depend on what geographic area you are concerned with. I imagine (but don't know for certain) that there may be places where government entities make the data available. Or maybe not. Regardless, generally, no, you can't get this data for free. It is expensive and challenging to collect, and no doubt Google pays someone a substantial fee for the data (and is probably forbidden from distributing raw data).
Meanwhile, the data Yahoo! offers is completely different from Google's traffic data. Yahoo! provides information about accidents, road work, etc. Google's information has to do with the actual speed of vehicles on the roadway. As far as I know, Google does not provide that information with the Maps API.
In any event, Google's raw traffic data is unavailable to your application.
As always, what various services offer can and will change and this answer may not age well. But it is, to the best of my knowledge, accurate at the current time.
精彩评论