Trying to use OpenLayers to (eventually) load markers, vectors & WMS on top of a google earth plugin base map. Google Earth does not appear to 'play well with others'.
If I instantiate a map in the 'google way': google.earth.createInstance('map', initCB, failCB);
I get a google map that I can add google placemarks to, but I can't pass that instance to OpenLayers.
Using the following:
map = new OpenLayers.Map('ol-map');
map.addControl(new OpenLayers.Control.LayerSwitcher());
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: G_PHYSICAL_MAP}
);
var gmap = new OpenLayers.Layer.Google(
"Google Streets", // the default
{numZoomLevels: 20}
);
var ghyb = new OpenLayers.Layer.Google(
"Google Hybrid",
{type: G_HYBRID_MAP, numZoomLevels: 20}
);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{type: G_SATELLITE_MAP, numZoomLevels: 22}
);
var gearth = new OpenLayers.Layer.Google(
"Google Earth",
{type: G_SATELLITE_3D_MAP}
);
map.addLayers([gphy, gmap, ghyb, gsat, gearth]);
map.setCenter(new OpenLayers.LonLat(-120, 32), 5)
addMarker();
This creates a basic OL map with 5 googly layers. I can see the marker I add when any of the map layers except when gearth is selected. As soon as I load the google earth map, it 'takes over' the entire div. All the OL controls such as the LayerSwitcher are gone and I haven't been able to figure out how to access the google earth instance from OL.
I'm assuming the markers are still present, but behind the basemap. Setting the opacity on the basemap has no effect.
Questions:
- Is this a documented limitation? I can't find anything that indicated it should not be possible.
- Is there a workaround where I can pass the OpenLayers map/layer instance to google earth's getEarthInstance call? Or vice versa? It seems like that would be the best of both worlds, giving me access to the GE API when needed, but I could use all the WFS processing in OL for most tasks.
Half-baked ideas welcome.