trouble figuring out basic requirements of tiles/xml for createTileMapServiceImageryProvider

I have a kml superoverlay and OpenLayers.html that both work for visualizing imagery posted here:

http://students.washington.edu/aritchie/quinault/

I thought that since I have a tilemapresource.xml it would be as simple as taking the imagery example in the sandbox and editing the code to point to “http://students.washington.edu/aritchie/quinault” instead of “https://cesiumjs.org/blackmarble”, but that doesn’t seem to work, and I am wondering if I have either a SRS problem (I’m using EPSG:4326) or if I need to define some kind of proxy.

Any help would be appreciated.

Andy

Hello Andy,

There are a few things going on here that are preventing this from working. To start, it looks like your tiles are starting at level 9, and the default minimumLevel for the tile map service imagery provider is 0. So, you need to specify the minumum level. However, this will make cesium try to load every tile at level 9, which will make way too many requests. And it looks like you only have tiles for a specific area, so you can specify the bounding rectangle for the tiles you have. Here is an example:

layers.addImageryProvider(Cesium.createTileMapServiceImageryProvider({
url : ‘http://students.washington.edu/aritchie/quinault/’,
rectangle: Cesium.Rectangle.fromDegrees(-123.88542367690528, 47.46019710639955, -123.50940150003458, 47.64278544372370),
minimumLevel: 9
}));

``

However, if you run this, you’ll see this error in the console: Image from origin ‘http://students.washington.edu’ has been blocked from loading by Cross-Origin Resource Sharing policy

This is because the server hosting the imagery doesn’t have CORS enabled. If you have any control over the server, you can see if they can enable CORS.

Otherwise, depending on the terms of use, you can try downloading the tiles to your own server. If the tiles are running on the same domain as your application, you shouldn’t run into this error.

Best,

Hannah

Hannah,

Thank you so much for your quick and super-helpful reply. I am looking into the CORS requirement now. Re specifying the bounding box, I assumed that I didn’t need to because it was in the tilemapresource.xml file. I guess I don’t fully understand how that xml file is used by cesium.

Andy

Hmm, yeah, you might not need it. I think Cesium does try to extract that information from the tilemapresource.xml file, but with the CORS error, the application couldn’t find it and was making a ton of requests to try to find tiles.
As you’re troubleshooting, I would leave it there until you get your CORS issue resolved, then try to remove it. Let me know if Cesium isn’t able to retrieve that information and I’ll check to see what’s going on =)

-Hannah

Hi Hannah,

I decided I might be able to bypass the CORS issue if I installed Cesium on the server. I got HelloWorld and Sandcastle both working when called from the server. But I still can’t pull up the tiles. I get the error (for example):

An error occurred in “UrlTemplateImageryProvider”: Failed to obtain image tile X: 5113 Y: 11459 Level: 15.

I added the bounding box and minimum zoom level in my local version of the SandCastle, but I still get errors about drawing layers lower than 9 too. I’m wondering if there’s a misconfiguration or something I’m missing in the root dir for the imagery:

http://students.washington.edu/aritchie/quinault/

I’m confused because it comes up no problemo in http://students.washington.edu/aritchie/quinault/openlayers.html

thanks for any help!

This might be happening because you don’t have tiles to fill up the whole rectangular region. Do any of the tiles load?

-Hannah

I zoomed in and out and all around, and none of the tiles load. Is there any other configuration information needed in the root directory of the tile service? Is there a tile service available I can check out, or would it be possible to get a dir listing of the blackmarble service at https://cesiumjs.org/blackmarble? I feel like if I can look at something that works I might be able to figure out why mine isn’t working. My dir structure is visible here:

http://students.washington.edu/aritchie/quinault/

and this sandbox should work for anyone:

http://students.washington.edu/aritchie/cesium/Apps/Sandcastle

(If I am not supposed to put up a link like this for some reason, let me know)

Andy