Custom Url format provider

If I have a set of tiles produced by a tool like Gdal2Tiles residing on an Azure REST endpoint but with an unusual ordering of z/y/x and a signature required for access, which provider should I use, and how do I create the necessary Url?

I would assume I should use TileMapServiceImageryProvider, but none of the examples indicate the url can contain substitutions or have an appended querystring, like:

http://foo.blob.core.windows.net/bar/z{z}/{y}/{x}.png?sr=c&si=lawrence&sig=lessig

Q1. Do I need to create my own provider, or does one of the existing providers already handle this situation?

Q2. Do I need to somehow override requestImage?

Q3. Are there any unusual CORS implications for this scenario?

Thanks!

If you have a tilemapresource.xml file, you should definitely start with TileMapServiceImageryProvider. If not, you could make your own standalone provider (the ImageryProvider interface is pretty easy to implement), or if you prefer to customize a TileMapServiceImageryProvider instance, that would work too.

Replacing the requestImage function is easy, because this is JavaScript. If you don’t have a tilemapresource.xml file, you should make sure to configure all of the options for min/max level, etc., appropriately when calling the constructor.

var provider = new Cesium.TileMapServiceImageryProvider({

url : β€˜http://etc’

});

provider.requestImage = function(x, y, level) {

// build the actual URL however you need, including the query string

var url = this._url + β€˜z’ + level + β€˜/’ + …;

return Cesium.ImageryProvider.loadImage(this, url);

}

1 Like