我正在尝试将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的代码片段:
...
<div class="form-group">
<div class="col-sm-8">
<div id="map-canvas" style="height:200px;width:400px;"></div>
</div>
</div>
...
什么可能是错误的这里?为什么地图不能在常规基础上渲染?
仅通过查找就很难说,但是当您将Geocoder零件拿出来时它很有用吗?你是否收到任何错误消息或任何东西?如果您可以提供尽可能多的关于您的问题的信息......“帮助我解决我的代码”问题在这里通常不会过于和蔼。 – Yumecosmos 2014-11-06 22:28:46
当您移除钥匙时会发生什么? – 2014-11-06 22:52:44