javascript - 如何将我的谷歌地图应用程序转换为谷歌地球应用程序?

标签 javascript google-maps-api-3 google-maps-api-2 google-earth-plugin

在maps.google.com上,您可以看到一个精彩的示例,展示了Google map 应用程序如何突然顺利地变成Google地球应用程序。

我正在开发一个 Google map 应用程序,使用 API 版本 3。我在 Google Earth API 摘要中阅读了以下行

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

但我搜索了几个小时,却没有找到任何如何在我的应用程序中启用 3D 的线索。我已经在 google.maps.Map 构造函数上构建了我的应用程序,并包含来自此网址的 google mas API:http://maps.google.com/maps/api/js

有谁知道我在说什么和/或知道如何在 1 行中在 google map 应用程序中启用 3D?

代码猴

最佳答案

Fraser 之前的回答非常适合 Maps API V2。不过,强烈建议使用 V3,因为 V2 已被弃用。

要在 V3 中获得类似的功能,您可以使用实用程序库 http://google-maps-utility-library-v3.googlecode.com/svn/trunk/googleearth/ -- 只需包含 javascript 库,然后在代码中实例化 map 的地球层:

var googleEarth = new GoogleEarth(map);

关于javascript - 如何将我的谷歌地图应用程序转换为谷歌地球应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5345375/

相关文章:

android - 在运行时设置 Google Maps v2 API key

javascript - 从元素 ID 获取 Json 元素值

javascript - Leaflet 相当于 google toSpan() 函数

javascript - 如何从 Google map 对象中隐藏公交车?

javascript - 如何将两个脚本合并到一个 Google map API 中

android - 没有 Play 服务的 Google map v2

java - 谷歌地方 API : refresh Place IDs with Java

JavaScript/jQuery 输入[type=text] 模式

javascript - 如何在运行时更改 ExtJS 工具提示文本?

javascript - Titanium - ScrollView 中的文本区域