Cesiumjs: How to update UrlTemplateImageryProvider's url?

269 views
Skip to first unread message

Aaron Feng

unread,
Jan 4, 2016, 11:35:47 AM1/4/16
to cesium-dev

I have UrlTemplateImageryProvider Layer on my Cesium earth.


var imageryProvider = new Cesium.UrlTemplateImageryProvider({
    url: 'servicerul?styleset=hybrid&x={x}&y={y}&z={z}'
});
var imageryLayer = new Cesium.ImageryLayer(imageryProvider, {
    maximumTerrainLevel: 20 
});
layerCollections.add(imageryLayer);

Now I need to change the UrlTemplateImageryProvider's url, which will be changed to servicerul?styleset=raster&x={x}&y={y}&z={z}, after clicking a button.

And show the replaced Imagery layer to Cesium earth.


Do you have any idea?

Hannah Pinkos

unread,
Jan 10, 2016, 3:23:09 AM1/10/16
to cesium-dev
Hello,

You will need to crate a new UrlTemplateImageryProvider with the updated URL.  Then you can remove the old imageryLayer from layerCollections and add the new one in it's place.

Best,

Hannah
Reply all
Reply to author
Forward
0 new messages