Live Traffic Overlay

Sep 9, 2009 at 11:42 AM

How can we add the Live traffic overlay to the Google Maps?

This is very good feature to the cutomer for checking the Live traffic conditions.

Please suggest...

 

Coordinator
Sep 9, 2009 at 11:46 AM

the real question is: where to get data about live traffic?

Sep 9, 2009 at 1:03 PM

Google provides the Live Traffic data. When you bowse cities in USA, you can see Live traffic by clicking on the button Live Traffic just beside the Map in the maps.google.com.

The java script method is

// The GTrafficOverlay is unique in that only one object of that type // should be added to a map. Adding multiple traffic overlays produces// no added benefit.

var map;var trafficInfo;
function initialize()
 {  map = new GMap2(document.getElementById("map_canvas"));   
map.setCenter(new GLatLng(49.496675,-102.65625), 3);   
var trafficOptions = {incidents:true};  
trafficInfo = new GTrafficOverlay(trafficOptions); 
 map.addOverlay(trafficInfo);
} 
http://code.google.com/apis/maps/documentation/services.html#Traffic_Overlays
And one more good feature is weather display
http://code.google.com/apis/ajax/playground/?exp=maps#map_weather_map
Coordinator
Sep 9, 2009 at 1:07 PM

..and yes, how you we can use API out of browser?

Sep 9, 2009 at 1:13 PM

good question, i have no clue how to use......

It could be great if API works with google maps in windows application.

Coordinator
Sep 9, 2009 at 4:39 PM

definitely, maybe google needs help in that area

Sep 16, 2009 at 5:58 AM

Did you find any information about the Live traffic?

Coordinator
Sep 16, 2009 at 1:10 PM

nop

Sep 17, 2009 at 1:34 AM

I have never bothered to study what google does (buggars constantly change their url's) but Bing maps does this :

static Uri buildUrl(int tileX, int tileY, int zoomLevel, MapTypes mapStyle)
  {
   string quadKey = tileToQuadKey(tileX, tileY, zoomLevel);

   string fileExtension = "";
   string terrain = "";
   string versionNumber = "244";
   string market = "&mkt=en-us";
   char mapStyleCharacter = 'x';


   switch (mapStyle)
   {
    case MapTypes.HybridSateliteLabels:
     fileExtension = ".jpeg";
     mapStyleCharacter = 'h';
     break;
    case MapTypes.Map:
     fileExtension = ".png";
     mapStyleCharacter = 'r';
     break;
    case MapTypes.Terrain:
     fileExtension = ".png";
     mapStyleCharacter = 'r';
     terrain = "&shading=hill";
     break;
    case MapTypes.Satellite:
     fileExtension = ".jpeg";
     mapStyleCharacter = 'a';
     break;
    case MapTypes.Traffic:
     fileExtension = ".png";
     mapStyleCharacter = 't';
     break;
    default:
     break;
   }

   if (mapStyle != MapTypes.Traffic)
   {
    return new Uri(String.Concat(new object[] { "http://", mapStyleCharacter, quadKey[quadKey.Length - 1], ".ortho.tiles.virtualearth.net/tiles/", mapStyleCharacter, quadKey, fileExtension, "?g=", versionNumber, market, terrain }));
   }
   return new Uri(String.Concat(new object[] { "http://", mapStyleCharacter, tileX & 1, ".traffic.virtualearth.net/Flow/", mapStyleCharacter, quadKey, fileExtension }));
  }