How do I convert my google maps application into a google earth application?

旧城冷巷雨未停 提交于 2019-12-01 11:33:06

To add the Google Earth instance to your map, simply add the G_SATELLITE_3D_MAP to your map with GMap2.addMapType().

var map = new GMap2(document.getElementById("map_canvas"),{ size: new GSize(640,480) } );
map.setCenter(new GLatLng(42.366662,-71.106262), 11);

// Enable the Earth map type
map.addMapType(G_SATELLITE_3D_MAP);

var mapControl = new GMapTypeControl();
map.addControl(mapControl);
map.setMapType(G_SATELLITE_3D_MAP);

Here is the information on Integrating v2 of the maps Api with the Google Earth Plugin http://code.google.com/apis/maps/documentation/javascript/v2/services.html#Earth

The previous answer by Fraser is perfect for V2 of the Maps API. However it's strongly recommended to use V3 since V2 has been deprecated.

To get similar functionality in V3 you can use the utility library at http://google-maps-utility-library-v3.googlecode.com/svn/trunk/googleearth/ -- simply include the javascript library, and then in your code instantiate the Earth layer for your map:

var googleEarth = new GoogleEarth(map);

Maybe Google means using KML(KMZ) files? This language supports by Googgle Earth and Google Map. I can make mistake, but it link is helpful - http://sketchup.wikia.com/wiki/KML

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!