现在的位置: 首页 > 综合 > 正文

Google Maps API非官方中文版发布

2013年06月02日 ⁄ 综合 ⁄ 共 1245字 ⁄ 字号 评论关闭
本BLOG转移到http://blog.gmap2.net

Google Maps API非官方中文版基于Google地图中文版。由于并非官方发布,所以无法保证长期有效。我只能保证在不违反Google TOS的条件下尽量保证升级,以方便大家使用。
调用此库的方法为

  1. <script src="http://api.gmap2.net/gmap2.cn.js" type="text/javascript"></script>

以下是关于本API的几点说明

  • 本API和官方的Google Maps API具有完全相同的接口,完全兼容,且无须申请Google的API Key(若此API失效,大家可直接改为调用官方库的方法,只是相应的中文数据可能会因此无法使用。使用官方库的方法见http://www.google.com/apis/maps/);
  • 本API语言已全部汉化为简体中文;
  • 本API在Google Maps中文官方网站的基础上添加了卫星地图,但由于数据整合上的困难,目前还无法得到混合地图;
  • 本API和官方一样,无法在中国和英国使用GeoCode功能。但如果本API能够长期稳定使用,本人将考虑添加新的GeoCode功能弥补这一遗憾,
  • 下面代码是一个demo(点击查看实例

    1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    2.   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    3. <html xmlns="http://www.w3.org/1999/xhtml">
    4.   <head>
    5.     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    6.     <title>Google Maps JavaScript API Example</title>
    7.     <script src="http://api.gmap2.net/gmap2.cn.js" type="text/javascript">
    8.     <script type="text/javascript">
    9.  
    10.     //<![CDATA[
    11.  
    12.     function load() {
    13.       if (GBrowserIsCompatible()) {
    14.         var map = new GMap2(document.getElementById("map"));
    15.         map.setCenter(new GLatLng(39.92, 116.46), 13);
    16.     map.addControl(new GMapTypeControl());
    17.       }
    18.     }
    19.  
    20.     //]]>
    21.     </script>
    22.   </head>
    23.   <body onload="load()" onunload="GUnload()">
    24.     <div id="map" style="width: 500px; height: 300px"></div>
    25.   </body>
    26. </html>

    抱歉!评论已关闭.