Hi luke, thanks for the welcome , yes actually I solved it, I don’t know if in the correct way but it seems that everything works.
The point of my application was to be able to add my 3d tiles from google to the standard cesim maps.
so the first step was to add my 3d tiles on the maps this is the code:
const google3DTileset = new window.Cesium.Cesium3DTileset({
url: ‘https://tile.googleapis.com/v1/3dtiles/root.json?key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’, // Enter the URL of your Google tiles here
});
const baseLayerPicker = viewerRef.current.baseLayerPicker;
// const imageryViewModels = ;
// Define the custom provider const customProviderViewModel = new window.Cesium.ProviderViewModel({ name: ‘Google 3D Tiles’, tooltip: ‘View Google 3D Tiles’, iconUrl: ‘/earth.png’, category : ‘Tiles 3d’, creationFunction: function () { return null; } });
baseLayerPicker.viewModel.imageryProviderViewModels.push(customProviderViewModel);
then to be able to observe the clicks on the other maps: window.Cesium.knockout.getObservable(baseLayerPicker.viewModel, ‘selectedImagery’).subscribe((selectedLayer) => { if (selectedLayer.category !== ‘Tiles 3d’) { const primitives = viewerRef.current.scene.primitives; const length = primitives.length; let existGoogle = false; for (let i = 0; i < length; ++i) { if (primitives._primitives[i]._url !== undefined) { const p = primitives.length; false;
// search google3DTileset
for (let i = 0; i < length; ++i) {
if (primitives._primitives[i]._url !== undefined) {
const p = primitives.get(i);
p.show = true;
existGoogle = true;
break;
}
}
if (!existGoogle) {
viewerRef.current.scene.primitives.add(google3DTileset);
}
}
this allowed me to make the map change work, as you can see on my map there are also two markers, so I had to check if the primitive had a url or not
hope this is useful to other users
Paul