按照 switch2osm.org 的指南,我成功搭建了自己的OSM瓦片服务器。
我使用Web浏览器验证了我的OSM瓦片服务器状态。例如,在http://localhost/osm_tiles/0/0/0.png处,我可以看到世界的小图片。在我的服务器端一切似乎都正常工作。
Cesium连接到在线地图源也很好用。
当我尝试将Cesium连接到本地OSM服务器时,问题出现了。在Firefox控制台中,我得到了以下错误:
"An error occurred in "": Failed to obtain image tile X: 1 Y: 1 Level: 1." Cesium.js:381:25514 "An error occurred in "": Failed to obtain image tile X: 1 Y: 0 Level: 1." Cesium.js:381:25514 "An error occurred in "": Failed to obtain image tile X: 0 Y: 0 Level: 1." Cesium.js:381:25514 "An error occurred in "": Failed to obtain image tile X: 0 Y: 1 Level: 1." Cesium.js:381:25514
我已经被这个问题卡了几天了。在网上搜索并没有提供我任何有用的线索。
以下是我正在运行Cesium的网页源代码:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version (or Chrome Frame if pre-IE11). -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Hello World!</title>
<script src="../Build/Cesium/Cesium.js"></script>
<style>
@import url(../Build/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<script>
//Initialize the viewer widget with several custom options and mixins.
var viewer = new Cesium.Viewer('cesiumContainer', {
//Hide the base layer picker
baseLayerPicker : false,
//Use OpenStreetMaps
imageryProvider : new Cesium.OpenStreetMapImageryProvider({
url : 'http://localhost/osm_tiles/'
//url : '//a.tile.openstreetmap.org/'
}),
// Show Columbus View map with Web Mercator projection
// mapProjection : new Cesium.WebMercatorProjection()
});
//Add basic drag and drop functionality
viewer.extend(Cesium.viewerDragDropMixin);
//Show a pop-up alert if we encounter an error when processing a dropped file
viewer.dropError.addEventListener(function(dropHandler, name, error) {
console.log(error);
window.alert(error);
});
</script>
</body>
</html>
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
。我无法在Apache端找到Cesium和Web浏览器之间请求日志的任何差异。 - Empty_Mind