Google Map API 系列(种类):

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

Google Map API 示例:

http://code.google.com/intl/zh-CN/apis/maps/documentation/javascript/v2/examples/

Google Maps API Premier 开发人员指南:

http://code.google.com/intl/zh-CN/apis/maps/documentation/premier/guide.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” xmlns:v=”urn:schemas-microsoft-com:vml”>
  <head>
    <meta http-equiv=”content-type” content=”text/html; charset=utf-8″/>
    <title>Google Maps JavaScript API Example: Simple Markers</title>
    <script src=”http://maps.google.com/maps?file=api&;v=2&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA
            type=”text/javascript”></script>
    <script type=”text/javascript”>
   
    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById(“map_canvas”));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
 
        // Add 10 markers to the map at random locations
        var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
        var lngSpan = northEast.lng() – southWest.lng();
        var latSpan = northEast.lat() – southWest.lat();
        for (var i = 0; i < 10; i++) {
          var latlng = new GLatLng(southWest.lat() + latSpan * Math.random(),
                                  southWest.lng() + lngSpan * Math.random());
          map.addOverlay(new GMarker(latlng));
        }
      }
    }

    </script>
  </head>
  <body onload=”initialize()” onunload=”GUnload()”>
    <div id=”map_canvas” style=”width: 500px; height: 300px”></div>
  </body>
</html>

发表评论

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