【发布时间】:2014-11-06 20:36:52
【问题描述】:
我正在尝试将 Google 地图集成到我的应用中。我已经阅读了 API v3 文档,生成了 API 密钥,但地图每小时加载大约 1 次。其他时区前图为空
我在 HTML 标头中用于地图渲染的这段代码:
<script src = "https://maps.googleapis.com/maps/api/js?key=HERE-IS-MY-UNIQUE-KEY"></script>
<script>
var geocoder;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(51.5073509,-0.1277583);
var mapOptions = {
zoom: 10,
center: latlng
}
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
这里是 HTML 的代码 sn-p:
...
<div class="form-group">
<div class="col-sm-8">
<div id="map-canvas" style="height:200px;width:400px;"></div>
</div>
</div>
...
这里有什么问题?为什么地图不能在常规基础上渲染?
【问题讨论】:
-
光看很难说,但是把Geocoder的零件拿出来就行了吗?您是否收到任何错误消息或任何东西?如果您能提供尽可能多的关于您的问题的信息,那就太好了……“帮我修复我的代码”问题通常不会在这里得到很好的对待。
-
删除密钥后会发生什么?
标签: google-maps google-maps-api-3