OpenStreetMap 经常发送网关超时错误
我在程序中使用带有以下代码的传单地图:
<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);#地图 {宽度:960px;高度:500px;}</风格><身体><div id="地图"/><脚本类型="文本/javascript">var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',osmAttrib = '©<a href="http://openstreetmap.org/copyright">OpenStreetMap</a>贡献者,osm = L.tileLayer(osmUrl, {maxZoom: 20, attribution: osmAttrib});var map = L.map('map').setView([37.5, -115], 6).addLayer(osm);</身体>
但是,我在地图上的随机位置不断看到一些灰色方块,并且在 javascript 控制台中收到以下 Leaflet 错误代码:
http://a.tile.openstreetmap.org/6/8/25.png 504(网关超时)
有人知道出了什么问题以及如何解决吗?
解决方案来自 OpenStreetMap 瓦片服务器的 50x 错误是 OSM 方面的问题,而不是您使用(或误用)OSM 瓦片引起的问题在您的网站或应用程序中.
从您提出问题的具体时间和日期来看,我会做出一个疯狂的假设,并说您在网络瞬时过载期间访问了一个 squid 代理服务器,而系统- 从 squid 2 到 squid 3 的全面升级在过去的几天里一直在进行(注意下面的截图是 git repo 的
请记住,OSM 磁贴服务器和代理服务器由(了不起的)志愿者系统管理员团队维护,虽然他们尽最大努力保持一切正常运行,但 OSM 基金会不对服务质量做出任何保证.
在 https://operations.osmfoundation.org/ 了解更多相关信息,特别是在 https://operations.osmfoundation.org/policies/tiles/
<块引用>有谁知道出了什么问题以及如何解决它?
一般来说,OSMF 服务的暂时故障可以通过以下方式解决:
- 耐心等待系统管理员解决问题.
- 潜伏在 OFTC #OSM-dev IRC 频道(此处了解更多信息)具体了解出了什么问题,礼貌地问.如果你这样做了,不要对那里的人造成滋扰;它只会减慢速度.
- 向 OSMF 捐款,以提高其运营能力.
- 自愿加入 OSMF 运营工作组,或为镜像硬件做出贡献服务器等.
如果您不想受 OSMF 的限制,有几个常见的替代方案:
- 使用商业磁贴提供商(其中一些提供商在此处列出)
- 托管您自己的磁贴(此处了解更多信息)
- 缓存图块.与大多数商业供应商不同,OSM 允许您以几乎任何您想要的方式存储、代理和缓存切片.事实上,我们鼓励任何可以减轻 OSMF 服务器负载的事情,只要您稍加注意(即不要为缓存设置种子,否则会触发批量下载).
I am using a leaflet map in program with the following code:
<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>
However, I keep seeing some grey square on my maps at random positions and I get the following Leaflet error code in the javascript console:
http://a.tile.openstreetmap.org/6/8/25.png 504 (Gateway Timeout)
Would anyone know what's wrong and how to solve it?
解决方案A 50x error from the OpenStreetMap tile servers is a problem caused on the OSM side of things, not a problem caused by your use (or misuse) of OSM tiles in your website or application.
Judging by the specific time and date of your question, I'll make a wild assumption and say that you were hitting one of the squid proxy servers during a momentary overload of the network while a system-wide upgrade from squid 2 to squid 3 has been going on for the past few days (note the screenshot below is for the git repo holding the chef devops recipes for the OSM servers, and also the fact that I can see the status of the OSM servers is awesome).
Please keep in mind that the OSM tile servers and proxy servers are maintained by a team of (awesome) volunteer system administrators and, while they do their best to keep everything up and running, the OSM Foundation can not make any guarantees about the quality of service.
Read more about this at https://operations.osmfoundation.org/ and specifically at https://operations.osmfoundation.org/policies/tiles/
Would anyone know what's wrong and how to solve it?
In general, temporarily failures of the OSMF services can be solved by:
- Having patience and waiting for the sysadmins to fix things.
- Lurking at the OFTC #OSM-dev IRC channel (more info here) to know specifically what's wrong and politely asking. If you do so, do not be a nuisance to the people there; it will only slow things down.
- Donating money to the OSMF so it can increase its operational capabilities.
- Volunteering to be a part of the OSMF Operations Working Group, or contributing with hardware for mirror servers or the like.
If you do not want to be bound by the limitations of the OSMF, there are a couple common alternatives:
- Use a commercial tile provider (some of the providers are listed here)
- Host your own tiles (more information here)
- Cache the tiles. Unlike most commercial vendors, OSM allows you to store, proxy, and cache the tiles in pretty much whatever way you want. In fact, anything that will lessen the load on the OSMF servers is encouraged, as long as you take a modicum of care (i.e. do not seed your cache, which would trigger bulk downloads).
相关文章