How to load tif Imagery?

This is my code:

    var viewer = new Cesium.Viewer("cesiumContainer");

    var imageryProvider = new Cesium.GeoTiffImageryProvider({
        url: './output300.tif'
    });

    viewer.imageryLayers.addImageryProvider(imageryProvider);

But I can not load tif imagery,Even if I upload the image to cesium ion, it’s useless, and according to the example code provided by cesium ion, the browser won’t display anything:

    Cesium.Ion.defaultAccessToken =  "";

    const viewer = new Cesium.Viewer("cesiumContainer");

    try {
        const imageryLayer = viewer.imageryLayers.addImageryProvider(
        await Cesium.IonImageryProvider.fromAssetId(id)
    );

I am having the same issue. I’m also trying to add an imagery (tif) to my code, manually and with cesium ion, but no luck. Anyone know how to solve this???

Hi there,

tif imagery is not supported loading directly into CesiumJS.

You can upload tif files to Cesium ion to tile and host imagery in a format that is supported by CesiumJS.

If you’re having issues with that, please let us know more details about what problems you’re running into.

Thanks!
Gabby

Would it be possible to provide a code snippet that demonstrates that. When i upload the tiff file on Cesium Ion, I get a code snippet like the one below:

const layer = viewer.imageryLayers.addImageryProvider(
await Cesium.IonImageryProvider.fromAssetId(#ASSETID)
);

However, when I add it to my file, it doesn’t work. What else in the code file do I have to add. It would be great if I could know as I can’t find it elsewhere. Thank you!

Here’s a working Sandcastle example.

Make sure you are setting Cesium.Ion.defaultAccessToken to your Cesium ion access token, otherwise you will not be authorized to access the data.

Where in the code do we add the Cesium.Ion.defaultAccessToken? As it’s not mentioned or provided in the sandcastle code

Cesium.Ion.defaultAccessToken = "<YOUR TOKEN HERE>;

should be the first line in your app.

Okay I added that, and changed the asset ID accordingly based on the geotiff’s i have uploaded on cesium. I don’t get any errors, but I don’t see any output either. Not sure what the issue is.

Could you provide your asset ID and a demo token for us to troubleshoot?

Okay, sent it to you as a msg.

Hi,

I’ve had a similar issue recently and ended up converting my geotiff data to a gltf in QGIS with the “QGIS2threejs” plugin and then directly displayed the gltf in cesium as entity. The only downside was, that the rotation of the gltf was a bit off, so I had to rotate the 3d model, but besides that it solved my problem.