# How to load tif Imagery?

**URL:** <https://community.cesium.com/t/how-to-load-tif-imagery/25160>\
**Category:** CesiumJS\
**Created:** [July 4, 2023, 7:01am UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160 "2023-07-04T07:01:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnn](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/nnn/32/11887_2.png) [@nnn](https://community.cesium.com/u/nnn)\
**Post date:** [July 4, 2023, 7:01am UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/1 "2023-07-04T07:01:21Z")

</div>

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)
    );

```

---

<div class="post-metadata">

**Author:** ![aaa](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/aaa/32/14037_2.png) [@aaa](https://community.cesium.com/u/aaa)\
**Post date:** [July 5, 2023, 11:05am UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/2 "2023-07-05T11:05:06Z")

</div>

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???

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [July 18, 2023, 3:01pm UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/3 "2023-07-18T15:01:21Z")

</div>

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](https://cesium.com/learn/3d-tiling/ion-tile-imagery/).

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

Thanks!  
Gabby

---

<div class="post-metadata">

**Author:** ![aaa](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/aaa/32/14037_2.png) [@aaa](https://community.cesium.com/u/aaa)\
**Post date:** [July 19, 2023, 7:11am UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/4 "2023-07-19T07:11:27Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [July 19, 2023, 6:56pm UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/5 "2023-07-19T18:56:56Z")

</div>

[Here’s a working Sandcastle example](https://sandcastle.cesium.com/#c=jZBPS8NAEMW/ypBTAmFjq6JoWqzFQ6H+AcVTLpPstFm62S0724QofnebRKVoD7KwMDPvN+8xSQIvJcEdOl8CenhQ69LHgJotbIxtDCDDrcZiA/fock0wPhldABo5SGHZ/ZyZwhr2UCtqyMEEDDUwJ1a7Srz2vTALir6eW+NRGXJZEMN7ZgByZFpiS+7qEFtUuCbX9gOxcrZ6crZWktyMW1OEHQg/Wmu+5N+inpgxk1/I8PRyNI46IIoz8xFdZ6Z7Q2KJg8U+8xBeqANjFijlr9UhNqj8v63PzqPBMYiDlH2raTpkB7hR1dY6DzunQyEST9VWoydO8l2xIS8K5g7tpGlyiKZS1aDk5MhNodDIvJ+sdlo/qzfKgmma7PV/UG1RKrN+rMlpbDtZOZouh6YQIk325XHSW6tzdL82fwI).

Make sure you are setting `Cesium.Ion.defaultAccessToken` to your [Cesium ion access token](https://cesium.com/learn/ion/cesium-ion-access-tokens/), otherwise you will not be authorized to access the data.

---

<div class="post-metadata">

**Author:** ![aaa](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/aaa/32/14037_2.png) [@aaa](https://community.cesium.com/u/aaa)\
**Post date:** [July 19, 2023, 8:41pm UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/6 "2023-07-19T20:41:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [July 20, 2023, 5:54pm UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/7 "2023-07-20T17:54:37Z")

</div>

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

should be the first line in your app.

---

<div class="post-metadata">

**Author:** ![aaa](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/aaa/32/14037_2.png) [@aaa](https://community.cesium.com/u/aaa)\
**Post date:** [July 24, 2023, 7:18am UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/8 "2023-07-24T07:18:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gabby\_Getz](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gabby_getz/32/7838_2.png) [@Gabby\_Getz](https://community.cesium.com/u/Gabby_Getz)\
**Post date:** [July 24, 2023, 6:15pm UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/9 "2023-07-24T18:15:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aaa](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/aaa/32/14037_2.png) [@aaa](https://community.cesium.com/u/aaa)\
**Post date:** [July 25, 2023, 7:20am UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/10 "2023-07-25T07:20:59Z")

</div>

Okay, sent it to you as a msg.

---

<div class="post-metadata">

**Author:** ![Jacques27](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jacques27/32/11887_2.png) [@Jacques27](https://community.cesium.com/u/Jacques27)\
**Post date:** [July 26, 2023, 5:26am UTC](https://community.cesium.com/t/how-to-load-tif-imagery/25160/11 "2023-07-26T05:26:53Z")

</div>

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.
