javascript - How do I convert my google maps application into a google earth application? - Stack Overflow

On maps.google you can see a brilliant example on how a google maps application can suddenly turn into

On maps.google you can see a brilliant example on how a google maps application can suddenly turn into a google earth application smoothly.

I'm developing a google maps application, working with API version 3. I read the following line in the Google Earth API summary

If you have an existing Maps API site, you can 3D-enable your page with as little as one line of code.

But I have searched for hours without finding any clue how to enable 3D in my application. I've built my application on the google.maps.Map constructor and included the google mas API from this url:

Does anyone know what I'm talking about and/or know how to enable 3D in a google maps application in 1 line?

Codemonkey

On maps.google. you can see a brilliant example on how a google maps application can suddenly turn into a google earth application smoothly.

I'm developing a google maps application, working with API version 3. I read the following line in the Google Earth API summary

If you have an existing Maps API site, you can 3D-enable your page with as little as one line of code.

But I have searched for hours without finding any clue how to enable 3D in my application. I've built my application on the google.maps.Map constructor and included the google mas API from this url: http://maps.google./maps/api/js

Does anyone know what I'm talking about and/or know how to enable 3D in a google maps application in 1 line?

Codemonkey

Share Improve this question edited Mar 24, 2011 at 11:27 Fraser 17.1k8 gold badges57 silver badges110 bronze badges asked Mar 17, 2011 at 21:18 HubroHubro 59.5k73 gold badges237 silver badges402 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

The previous answer by Fraser is perfect for V2 of the Maps API. However it's strongly remended 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./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);

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./apis/maps/documentation/javascript/v2/services.html#Earth

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./wiki/KML

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745427129a4627230.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信