Following guide at switch2osm.org I was able to get my own OSM tile server running.
I did have verify state of my OSM tile server by using webrowser. For example at http://localhost/osm_tiles/0/0/0.png I get small picture od world. Evertthing seems to be working at server side to me.
Cesium connected to online source of maps works fine as well.
Problem pops up, when i try connect Cesium to local OSM server. In Firefox console i get this error:
"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
I'm stuck at this problem for few days. Searching web did not provide me any useful clues.
Here is sourcecode of webpage I'm running Cesium from:
<!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
. I was not able to find any difference in logs on Apache side between request from Cesium and webrowser.Error: Port 8080 is already in use, select a different port. Example: node server.js --port 8081 { [Error: listen EADDRINUSE] code: 'EADDRINUSE', errno: 'EADDRINUSE', syscall: 'listen' }
Now I'm going to try cors.