CORS restriction despite page & tiles on same domain?

38 views
Skip to first unread message

Rainer Simon

unread,
Jul 15, 2015, 2:53:15 AM7/15/15
to webgl...@googlegroups.com
Hi!

This is probably a newbie-question... but I can't seem to get my own (TMS) tileset to work. Running this on Firefox/Linux, and I'm getting the cross-domain access restriction warning, although I've placed all files on the same domain. My folder structure on the remote server is

/virtual-globe/
  /tiles/
  api
.js
  index
.html


The contents of the index.html is taken right out of the Hello World example:


<html>
 
<head>
   
<script src="api.js"></script>
   
<script>
     
function initialize() {
       
var options = {atmosphere: true, center: [0, 0], zoom: 0};
       
var earth = new WE.map('earth_div', options);
        WE
.tileLayer('http://mydomain.org/virtual-globe/tiles/{z}/{x}/{y}.jpg', {
          tms
: true
       
}).addTo(earth);
     
}
   
</script>
   
<style>
      html
, body{ padding: 0; margin: 0; }
     
#earth_div{ top: 0; right: 0; bottom: 0; left: 0;
        background
-color: #000; position: absolute !important;}
   
</style>
   
<title>WebGL Earth API: Satellite</title>
 
</head>
 
 
<body onload="initialize()">
   
<div id="earth_div"></div>
 
</body>
</html>

Any thoughts on what might be going wrong there? The default Hello World tiles (http://otile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg) work just fine, but I assume that's because the tile server has the CORS header set?

Thanks in advance,
Rainer

Rainer Simon

unread,
Jul 16, 2015, 4:25:36 AM7/16/15
to webgl...@googlegroups.com
Ok, found out what the problem was - and it wasn't related to CORS at all. Seems my tileset was missing tiles at zoom level 0. So it seems WebGL Earth (or Cesium underneath?) got the 404 errors for the images and stopped execution and displayed a generic error warning (which included the bit about CORS as one possible cause.)

Works now!

Cheers,
R
Reply all
Reply to author
Forward
0 new messages