WMS Imagery provider with multiple URLS

Hello,

got a pretty simple WMS but was looking at ways to speed it up, and thought I’d just try the openlayers theory of multiple URLS; (to avoid the browsers limitation to make a certain amount of simultaneous requests (6?) to the same URL).

smWMS = new Cesium.WebMapServiceImageryProvider({

url: ['http://url1/servlets/wms?’, 'http://url2/servlets/wms?’, 'http://url3/servlets/wms?’, 'http://url4/servlets/wms?’],

layers: layerArray,

parameters: {

transparent: ‘true’,

format: ‘image/png’

},

proxy: new Cesium.DefaultProxy(proxy)

});

Now, this does actually display images (surprising, the actual requests look pretty strange), but I don’t know if it is actually any faster - I presume not as this isn’t intended to be done?

Toby

Hey Toby,

The WebMapServiceImageryProvider doesn’t currently support grabbing images from multiple URLs. It would probably be pretty easy to add support, though. Take a look at BingMapsImageryProvider for an example of how it can be done. If you add this feature, we’d love to see a pull request with it.

Kevin

Ok, I’ll do my very best - will have to get on the github learning curve…

I’ll add it as a feature request on github and ask some additional questions there…

T

One other thing to mention is that since you’re using a proxy to request tiles, the actual requests look like:

http://localhost:8080/proxy?http://url1/.

http://localhost:8080/proxy?http://url2/.

http://localhost:8080/proxy?http://url3/.

So you’ll need to make your WMS servers properly support the CORS header, and removing the need for the proxy at all (preferred option), or you’ll need to have multiple proxy servers available in order to get above 6 concurrent requests to the same origin.

You can easily implement your JavaScript proxy class that round-robins using a set of proxy servers, instead of using DefaultProxy. All you need to do is pass an object with a getURL function which returns the proxied url. For example:

var myProxy = {

counter : 0,

proxies : [‘http://proxyhost1’, ‘http://proxyhost2’],

getURL : function(url) {

var proxy = this.proxies[++this.counter % this.proxies.length];

return proxy + ‘?’ + encodeURIComponent(url);

}

};

Great, let us know if you have any questions.