【问题标题】:Google maps API javascript谷歌地图 API javascript
【发布时间】:2014-07-11 14:48:52
【问题描述】:

您好,我在我的页面http://topdoctor.eu.pn/ 上遇到了谷歌地图 API 的问题 其中与医生相关的名称包括指向其地址的链接。 因为我在 API 访问下的 code.google.com 中创建 API 密钥,并在生成密钥的简单 API 访问下创建密钥。 然后我的网站上有 scipt

var map;

var directionsDisplay = new google.maps.DirectionsRenderer({ 'map': map,draggable: true }); 
var mapprint;

    function initialize()
    {
        var myCenter=new google.maps.LatLng(00,00);
    var marker;
    var mapProp = {
      center:myCenter,
      zoom:14,
      mapTypeId:google.maps.MapTypeId.ROADMAP
      };
     map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
      marker=new google.maps.Marker({
      position:myCenter,
      icon:"Your image path on map",
      });
    marker.setMap(map);
          var info ="Your Info";


         var myOptions = {
                 content: info
                ,disableAutoPan: false
                ,maxWidth: 0
                ,pixelOffset: new google.maps.Size(20, -158) //used for positioning left,right
                ,zIndex: null
                ,boxStyle: { 
                  background: ""
                  ,opacity: 1.0
                  ,width: "220px"
                 }
                ,closeBoxMargin: "10px 2px 2px 2px"
                ,closeBoxURL: ""
                ,infoBoxClearance: new google.maps.Size(1, 1)
                ,isHidden: false
                ,pane: "floatPane"
                ,enableEventPropagation: false
                ,url:"http://www.topdoctor.eu.pn/"
            };
         var ib = new InfoBox(myOptions);
         google.maps.event.addListener(marker, "click", function (e) {
                ib.open(map, this);
            });

             google.maps.event.addListener(map, "click", function (e) {
                ib.closeListener_ = google.maps.event.addDomListener(map, 'click', ib.getCloseClickHandler_());
                ib.close();

            });
            google.maps.event.addListener(ib, "click", function (e) {

                window.parent.location.href = "http://www.topdoctor.eu.pn/";
            });

            google.maps.event.trigger(map, 'resize');

    }
    google.maps.event.addDomListener(window, 'load', initialize);
    </script>
     <style type="text/css">
     body{background-color:#fff;}
     </style>

    <div id="googleMap" class="gmap" style="width: 100%; height: 100%;"></div>



    <div id="map-canvas">



    </div><!-- map -->

但地图没有显示,或者说密钥未启用或已达到配额,即使网站上没有流量或流量很少。

【问题讨论】:

    标签: javascript php api google-maps


    【解决方案1】:

    确保 Google Maps JavaScript API 的状态为 ON,并且写在那边 Courtesy limit: 25,000 requests/day 表示您可以在一天内请求 25,000 个。 如需查看整个请求详情,请点击Report 菜单并查看您的 API 的流量详情。如果超过限制,您将无法在特定日期使用 API。

    你可以找到here

    【讨论】:

    • API 已启用,我正在获取这些统计信息。 TopDoctor 的流量报告 请求总数 15 请求/天 3 峰值 0.54 平均 开始日期 2014 年 6 月 14 日 示例期 28 天,因此无法达到限制,但地图未显示在配置文件下
    • 使用右侧的链接Download Historical Quota Usage Data交叉检查您的数据使用情况
    • 显示此 Maps API v3 请求数量每日配额:25k 28 天总计:15
    猜你喜欢
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    • 2016-09-30
    • 2017-01-08
    • 2018-02-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多