`

google map 应用学习网站

阅读更多

Google Maps API中文同步文档

http://www.codechina.org/doc/google/gmapapi/

 

Google 地图 API

主页 http://code.google.com/intl/zh-CN/apis/maps/

文档 http://code.google.com/intl/zh-CN/apis/maps/documentation/index.html

API  http://code.google.com/intl/zh-CN/apis/maps/documentation/reference.html 

 

 

 Google Map学习(一) 简单的Google Map,Google Map基础

http://www.cnblogs.com/psunny/archive/2009/08/26/1554476.html

 

Google 地图 API 示例 - 地理学习小游戏

http://code.google.com/intl/zh-CN/apis/maps/documentation/demos/geogame/geogame.html

 

 

贴一个自己测试的html上来:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   
<html xmlns="http://www.w3.org/1999/xhtml">   
  <head>   
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>   
    <title>Google Maps JavaScript API Example</title>   
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA4ZZxnijCQhlZlf57igoGExTwM0brOpm-All5BF6PoaKBxRWWERR0mYEVnCnlZi8Qmoq3uoivZ9cIgQ"  
            type="text/javascript"></script>   
    <script type="text/javascript">   
    //<![CDATA[   
  
    function load() {   
      if (GBrowserIsCompatible()) {   
        var map = new GMap2(document.getElementById("map"));   
        map.setCenter(new GLatLng(39.917, 116.397), 14);   
      }   
  
      var map2 = new GMap2(document.getElementById("map2"));   
      map2.setCenter(new GLatLng(37.4419, -122.1419), 13);   
      window.setTimeout(function() {   
        //panTo后的大小和上面的setCenter不一样的   
        //map2.panTo(new GLatLng(39.917, 116.397),14);   
        map2.panTo(new GLatLng(39.917, 116.397));//后面一个参数无效的   
      }, 2000);   
  
      var map3 = new GMap2(document.getElementById("map3"));   
      map3.setCenter(new GLatLng(39.917, 116.397), 14);   
      map3.openInfoWindow(map.getCenter(),   
              document.createTextNode("Hello, world"));   
    } 
	//根据经纬度计算两点距离
  var distance = new GLatLng(39.917, 116.397).distanceFrom(new GLatLng(37.4419, -122.1419));
  alert(parseInt(distance/1000,10) + "公里");
    //]]>   
    </script>   
  </head>   
  <body onload="load()" onunload="GUnload()">   
    <div id="map" style="width: 500px; height: 200px"></div>   
    <div id="map2" style="width: 500px; height: 200px;margin-top:10px;"></div>   
    <div id="map3" style="width: 500px; height: 200px;margin-top:10px;"></div>   
  </body>   
</html>  

  

分享到:
评论
2 楼 zdz8207 2010-05-27  
xjq2008 写道
测试的html中 JavaScript 提示 GMap2 无效
还有那个 key 谁都可以用吗?

key要自己申请个本地的
1 楼 xjq2008 2010-05-24  
测试的html中 JavaScript 提示 GMap2 无效
还有那个 key 谁都可以用吗?

相关推荐

Global site tag (gtag.js) - Google Analytics