How can I use Google Adsense inside OpenLayers using a google maps layer?
Code to use adsense inside a google maps (v2) map:
map = new GMap2(document.getElementById("Gmap"));
adsManager = new GAdsManager(
map,
"ca-pub-xxxxxxxxxxxxxxxx",
{
maxAdsOnMap : 4,
style: 'adunit'
}
);
adsManager.enable();
## The HTML:
<div id="Gmap"></div>

Code to display google maps in openlayers:
map = new OpenLayers.Map("olmap")
var gmap = new OpenLayers.Layer.Google("Google Streets", {numZoomLevels: 20});
map.addLayers([gmap]);
## The HTML:
<div id="olmap"></div>
Is there any way to get the google maps object inside openlayers? Then I could use the first code to add the ads.
I found it! Looking at Openlayers source code and firebug 🙂
It seems that when you have this code
you can use this js to reference the google maps object
So, according to this, it would be something like
(not tested)