我正在使用下面的代码在程序中使用leaflet地图:
<style>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin=""/>
@import url(//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.2/leaflet.css);
#map {
width: 960px;
height: 500px;
}
</style>
<body>
<div id="map"/>
<script type="text/javascript">
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
osm = L.tileLayer(osmUrl, {maxZoom: 20, attribution: osmAttrib});
var map = L.map('map').setView([37.5, -115], 6).addLayer(osm);
</body>
然而,我在地图上的随机位置看到一些灰色方块,并在javascript控制台中得到以下Leaflet错误代码:
http://a.tile.openstreetmap.org/6/8/25.png 504 (Gateway Timeout)
有人知道是什么问题以及如何解决吗?