ImageryLayer API

Hi All,

I try to get the ImageryLayer from centralBody, I always got “undefined”. Is the API changes?

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var imageryLayers = viewer.centralBody.imageryLayers;

alert(imageryLayers);

I look at the document and change ‘imageryLayers’ to ‘imageryLayer’, still ‘undefind’.

Then I loop ‘centralBody’ object, I only got ‘_imageryLayerCollection’, there’s no ‘imageryLayer’. So how to get ‘ImageryLyaer(s)’ from ‘centralBody’? Thanks.

The code you posted is correct for b26. In b25 and older versions, the imageryLayers property was a function named getImageryLayers().