I’m wanting a custom Imagery and Terrain Menu. I’ve found this thread . . .
. . . I have gotten to the point where I see my icon with my custom menu item, which is great but it does not line up with the other icons. If I use the baseLayerPicker = false, the default icon goes away and that’s what I want but how to I fit my custom icon into position?
Also:
I’m also willing to ditch this and alter the createDefaultImageryProviderViewModels.js file. I’m using Cesium-1.119 and in the path . . . “packages\widgets\Source\BaseLayerPicker” I have removed items but when restarting the node server the changes do not show up.
const viewer = new Cesium.Viewer("cesiumContainer", {
imageryProviderViewModels: [
new Cesium.ProviderViewModel({
name: "Earth at night",
iconUrl: Cesium.buildModuleUrl(
"Widgets/Images/ImageryProviders/earthAtNight.png"
),
tooltip:
"The Earth at night, also known as The Black Marble, is a 500 meter resolution global composite imagery layer released by NASA.",
category: "Cesium ion",
creationFunction: function () {
return Cesium.IonImageryProvider.fromAssetId(3812);
},
})
]
});
I want to adjust the list of imagery and terrain providers displayed. I only need 2 or 3 of the imagery options instead of the 15 or so that it shows.
Yes, the code you provided is similar to the code I used to limit the imagery items on the menu. That part I got working. I guess my issue is how to align the newly created ProviderViewModel icon with the other icons as in my screenshot at the top?
Excellent, your example worked! That’s exactly what I was trying to accomplish. I see that the difference was that you had created your Cesium.ProviderViewModel inside the viewer constructor.
I was creating it outside the viewer and using the push function to add it to the viewer which created a 2nd icon as in the screenshot above.