Stack raster imagery (geotiff) and colour by pixel value

const viewer = new Cesium.Viewer("cesiumContainer", {
  timeline: false,
  animation: false,
  terrainProvider: await Cesium.createWorldBathymetryAsync({
    requestVertexNormals: true,
  }),
});

const tilesetA = await viewer.imageryLayers.addImageryProvider(
  await Cesium.IonImageryProvider.fromAssetId(2770107),
);

const tilesetB = await viewer.imageryLayers.addImageryProvider(
  await Cesium.IonImageryProvider.fromAssetId(2770105),
);

const tilesetC = await viewer.imageryLayers.addImageryProvider(
  await Cesium.IonImageryProvider.fromAssetId(2770097),
);

viewer.zoomTo(tilesetA);

Above is an example of 3 raster layers I am trying to view. They all cover the same area, just different depths. So I’d like to colour them according to pixel value in Red Amber Green colour scheme - is this possible?

I was also wondering if I can display them according to height too? I know for 3D tiles you can do

 const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(assetId);  
    tileset.modelMatrix = Cesium.Matrix4.fromTranslation(  
        new Cesium.Cartesian3(0, 0, 0)  
    ); 

but I would like to display them according to their pixel value (height)

Hi @a.okeefe289,

This sounds like a very interesting use case! Would you mind telling us more about it?

I think you may be a bit limited in your approach by using imagery layers. For example, while you can make some basic color adjustments to an imagery layer, I’m not sure there is a direct way to map the value to a custom color scale. Likewise, there’s no built-in way to adjust the height of an imagery layer beyond using a terrain dataset.

However, there are many other systems in CesiumJS that may be able to accomplish what you’re looking for: terrain, 3D Tiles, or custom primitives. It would be helpful to know what your source data is so we can recommend an alternative approach.

Thanks!
Gabby

Hi @Gabby_Getz , I’ve sent you a message :slight_smile:

I originally had las data which needed interpolated and rasterized. The result of this is a GeoTIFF. Ideally, I’d like the 3 GeoTIFFs as 3D Tiles so that I can view them stacked, as they cover the same area just different height values for ship navigation.

However, Cesium Ion doesn’t support GeoTIFF as 3D tiles and I need the raster format or the raster converted to a meshed point cloud in order to provide a surface. Points aren’t useful in this case.

Perhaps you could help advise?

Awesome, thanks @a.okeefe289.

You’re correct that Cesium ion doesn’t support a direct GeoTIFF to 3D Tiles conversion. However, I wonder if there’s room for a more custom workflow.

It definitely possible to use a GeoTIFF to create a DEM file. From there one could create a TIN mesh, then export as .gltf or .obj. This can be used to create 3D Tiles in Cesium ion.

Once you have each 3D Tiles dataset in CesiumJS, it’s possible to apply custom colors, and show and hide each tileset as needed.

There has been interest in Terrain to 3D Tiles workflows using Cesium ion, but those tools are in progress and not yet available publicly.

Hi Gabby,

Unfortunately gltf/obj aren’t holding the spatial reference so I’m getting 3D tiles up in the air.

Is there any way to track the progress of Terrain to 3D Tiles workflows in the coming months? It’s definitely something I’d be keen to see implemented!

Hi,

It is possible to adjust the tileset position in Cesium ion, or adjust tileset height at runtime in CesiumJS.

Hm, I’m not sure if there is a place to track progress on Terrain to 3D Tiles. It would warrant an announcement on our blog. I might also suggest reaching out to sales@cesium.com and expressing your interest.