Using the V2 API, I found it was quite easy to add Google overlays into the
Google layer class.
I just added properties and methods like
trafficOverlay: null,
trafficOverlayVisible: false,
addTrafficOverlay: function ()
{
if (this.mapObject != null)
{
var trafficOptions = { incidents: true };
this.trafficOverlay = new GTrafficOverlay(trafficOptions);
this.mapObject.addOverlay(this.trafficOverlay);
}
this.trafficOverlayVisible = true;
},
removeTrafficOverlay: function ()
{
if (this.mapObject != null)
{
if (this.trafficOverlay != null)
{
this.mapObject.removeOverlay(this.trafficOverlay);
}
}
this.trafficOverlayVisible = false;
},
hideTrafficOverlay: function ()
{
if (this.trafficOverlay != null)
{
this.trafficOverlay.hide();
this.trafficOverlayVisible = false;
}
},
showTrafficOverlay: function ()
{
if (this.trafficOverlay == null)
{
var trafficOptions = { incidents: true };
this.trafficOverlay = new GTrafficOverlay(trafficOptions);
this.mapObject.addOverlay(this.trafficOverlay);
}
this.trafficOverlayVisible = true;
this.trafficOverlay.show();
},
There might be a better implementation, but this works. I was able to add
the StreetView overlay the same way.
It would probably be possible to do the same sort of thing for Google V3.
Rohan Parkes
From: [email protected]
[mailto:[email protected]] On Behalf Of james croft
Sent: Friday, 10 December 2010 11:46 AM
To: [email protected]
Subject: [OpenLayers-Users] Using Google traffic overlay in OpenLayers
Hi,
I am using the newest version of OpenLayers (which supports the Google Map
V3 API).
Is it possible to display google overlays, specifically the traffic overlay,
on the OpenLayers map?
The traffic overlay is documented here:
http://code.google.com/apis/maps/documentation/javascript/overlays.html#Traf
ficLayer
Thanks
James
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users