ol-cesium icon indicating copy to clipboard operation
ol-cesium copied to clipboard

Changing ol layer's source doesn't work in Cesium

Open jheijari opened this issue 6 years ago • 1 comments

As a developer, I'd like to be able to change layer's source.

I'm using ol to show Bing Maps. I have different ol sources for Road, Aerial and AerialWithLabels imagery sets. I have one ol layer so I can maintain the correct position/index all the time. Switching the layers imagery works by changing the source in ol, but the change doesn't get synchronized to Cesium.

jheijari avatar Feb 15 '19 11:02 jheijari

Hi @jheijari, it is probably possible to handle this. See https://github.com/openlayers/ol-cesium/blob/master/src/olcs/AbstractSynchronizer.js.

When adding a layer we could listen for layer 'change:source' event and recreate the synchronized objects. However this is fairly low level and if you need this feature only for 1 layer you are probably better trying the following workaround:

  • remove the layer form OpenLayers;
  • add it back (same layer).

gberaudo avatar Feb 18 '19 09:02 gberaudo