/ 博客 / 3375浏览

在WordPress网页中嵌入谷歌地球(Google Earth)

方法:
1、到 http://code.google.com/intl/zh-CN/apis/maps/signup.html 去申请自己网站的Google Maps API密钥;
2、到 http://code.google.com/intl/zh-CN/apis/earth/documentation/index.html 去学习Google地球API开发人员指南;
3、在WordPress后台找到外观 - 编辑 - 顶部(header.php),将下面这段插入到<!--header END-->之前:

//ABCDE是你的Google Map API   
<script src="https://www.google.com/jsapi?key=ABCDE"></script>   
   <script type="text/javascript">   
      var ge;   
      google.load("earth", "1");   
  
      function init() {   
         google.earth.createInstance('map3d', initCB, failureCB);   
      }   
  
      function initCB(instance) {   
         ge = instance;   
         ge.getWindow().setVisibility(true);   
      }   
  
      function failureCB(errorCode) {   
      }   
  
      google.setOnLoadCallback(init);   
</script>

4、将下面这段插入到你的任意一篇新文章或页面中:

<div id="map3d" style="height: 400px; width: 600px;"></div>

5、如果要更多效果(例如在地球上显示某个坐标),请参考第2条中的链接地址,里面有大量的教程。

另外,关于如何在WordPress博客插入Google Earth地图,请参见《谷歌地图(Google Map)中iframe实现跳转新窗口打开链接功能》。

方法:
1、到 http://code.google.com/intl/zh-CN/apis/maps/signup.html 去申请自己网站的Google Maps API密钥;
2、到 http://code.google.com/intl/zh-CN/apis/earth/documentation/index.html 去学习Google地球API开发人员指南;
3、在WordPress后台找到外观 - 编辑 - 顶部(header.php),将下面这段插入到<!--header END-->之前:

//ABCDE是你的Google Map API   
<script src="https://www.google.com/jsapi?key=ABCDE"></script>   
   <script type="text/javascript">   
      var ge;   
      google.load("earth", "1");   
  
      function init() {   
         google.earth.createInstance('map3d', initCB, failureCB);   
      }   
  
      function initCB(instance) {   
         ge = instance;   
         ge.getWindow().setVisibility(true);   
      }   
  
      function failureCB(errorCode) {   
      }   
  
      google.setOnLoadCallback(init);   
</script>

4、将下面这段插入到你的任意一篇新文章或页面中:

<div id="map3d" style="height: 400px; width: 600px;"></div>

5、如果要更多效果(例如在地球上显示某个坐标),请参考第2条中的链接地址,里面有大量的教程。

另外,关于如何在WordPress博客插入Google Earth地图,请参见《谷歌地图(Google Map)中iframe实现跳转新窗口打开链接功能》。

10

  1. S

    is it? i don't think so... anyway thx for making it as ur favorite..

    Firefox 3 · Windows 7
  2. ric83311

    I'm very lazy on this kind of thing now, I was fond of these when I was young, ahahahaha....

    Maxthon 2 · Windows XP
  3. ric83311

    Oh, complicated, keep it as the favorite at least...

    Maxthon 2 · Windows XP
    1. 爱软E

      @ric83311是插件啊

      Firefox 16 · Windows 8
  4. S

    @ric83311
    yes you are old

    Firefox 3 · Windows 7
  5. ric83311

    @老虎
    是啊,你多年轻啊

    Maxthon 2 · Windows XP
  6. S

    @ric83311
    你好,老头

    Firefox 3 · Windows 7
    1. ric83311

      @S没完了你。。。

      Maxthon · Windows XP
      1. S

        @ric83311这就完了

        Google Chrome 7 · Windows 7
        1. ric83311

          @Ssigh...

          Maxthon 2 · Windows XP

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注