WebMapServiceImageryProvider optional parameters

Hello all,

i was trying to upgrade one of my older projects to the newest version of cesium and i noticed that starting 1.12 the WebMapServiceImageryProvider has been modified moving this._parameters to var parameters.

I used this to change parameters directly to add custom parameters to the request. Now if i am not mistaken i can't change parameters once the ImageryProvider instance has been created i would need to create a new instance every time?

Am i mistaken, is there any way to change the parameters that i have not seen?

If not i imagine i could create a new instance every time i need to change a parameter, seems a bit wasteful, but is there some way to clone an imagery provider or similar?

Thank you for any help,
kind regards,

Hello Daniel,

It looks like you’ll have to create a new one when the parameters change. We made changes elsewhere in the code that don’t allow those options to change on the fly anymore.



That’s kind of the downside of private properties, they can change underneath you.

You could try and modify the new private parameters, but there’s always a chance they could change to.

There’s an interface under the imageryProvider for the underlying urlTempalteProvider, imageryProvider._tileProvider._urlParts that is part of creating the underlying tile requests. If you want to mess around with private interfaces that could change, that’d be a place to look.

Hello again,

thank you Denver Pierce for pointing me to the urlparts, i would say this shoul probably not be used but as a workaround i used this if anyone needs this for some reason.

Cesium.WebMapServiceImageryProvider.prototype.updateProperties = function(property, value) {

    property = "&"+property+"=";

    // Have to make sure value is a string if number cesium crashes
    // as it expect either a string or a 'part'
    value = ""+value;

    var i = _.indexOf(this._tileProvider._urlParts, property);
    if (i>=0){
        this._tileProvider._urlParts[i+1] = value;

Just add it somewhere to add this functionality to the WMS Provider.

layer.imageryProvider.updateProperties("time", string);

Also important to notice i am making use of underscore.js to get the index in the array.

Seems to work as i expect it, not sure if i will be using it, but at least with this i could update to 1.14.

Thanks again,
kind regards.