I use this bit of code below to retrieve and display google heatmaps on a google 3d photorealistic terrain. Problem is that the imagerylayers collection is undefined and i’m not able to add the layer. Any ideas why the imagerylayers collection remains undefined?
export async function addTilesetFromGoogleAQI() {
let heatMapLayer;
const zcoord = 2;
const xcoord = 0;
const ycoord = 1;
const layers = viewer.scene.imageryLayers;
if (layers) {
let url = https://airquality.googleapis.com/v1/mapTypes/US_AQI/heatmapTiles/${zcoord}/${xcoord}/${ycoord}?key=${"xxxxxxxxxxxxxxxxxxx"}
;
let singleTileProvider = await Cesium.SingleTileImageryProvider.fromUrl(url, { rectangle: Cesium.Rectangle.fromDegrees(-180.0, 4.0, -90, 72.75) });
heatMapLayer = new Cesium.ImageryLayer(singleTileProvider);
layers.add(heatMapLayer);
heatMapLayer.show = true;
}
return heatMapLayer;
}