Terrain heightmaps converted from .tiff by terrain-tiler do not show

Hi cesium team,

I converted my Geotiff to terraindb file by Terraintiler of 3D TIlling but it does not show at my local.

I already test the geotiff at my cesium ion and it was successfully shown and zoom into the dtm terrain.

What am I doing wrong and how do I zoom to it?

I tried this below:

  var viewer = new Cesium.Viewer('cesiumContainer', {
        terrainProvider : new Cesium.CesiumTerrainProvider({
            url : 'http://localhost:8002/lasd'
        })
    });

viewer.zoomTo('http://localhost:8002/lasd')

Hi,

If I understand your question correctly, you’re trying to zoom to a tileset that is being served by asset-server on an on-premises device.

First, you should note the path that asset-server outputs when you run it. In my case, I ran this command:

../tilers-win/bin/asset-server -d ../_tilesets/Cube-glb

And I received this message:

[Worker 1] Serving static directory ..\_tilesets\Cube-glb on /static/Cube-glb
[Worker 1] Serving on port 8002

Based on this, I know which path I need to use in Sandcastle:

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

var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
    url : 'http://localhost:8002/static/Cube-glb/tileset.json'
}));

viewer.zoomTo(tileset);

Matt

Thanks for the reply.

in my case, I do it like this and I changed some of my code, but it doesn’t still work.

C:\Users\kjohn\Documents\Cesium\Cesium-ion-3D-Tiling-Pipeline-Windows-4.4.3\bin>asset-server.exe -d C:\laragon\www\CesiumIonSDK\3DTileset
[Worker 1] Serving static directory C:\laragon\www\CesiumIonSDK\3DTileset on /static/3DTileset
[Worker 1] Serving on port 8002
terrain-tiler.exe -i C:\Users\kjohn\Desktop\3D_files\GeoTIFF\NagaiOoeRoad.tif -o C:\Users\kjohn\Desktop\3D_files\GeoTIFF\NagaiOoeRoad.terraindb
      var viewer = new Cesium.Viewer('cesiumContainer', {
            terrainProvider : new Cesium.CesiumTerrainProvider({
                url : 'http://localhost:8002/static/3DTileset/NagaiOoeRoad'
            })
        });

Also, how do I zoom to Terrain tiller?

Thanks in advance!
Hiroshi

Hi Hiroshi,

Apologies—my example wasn’t specific to terrain. Please see this documentation, under “Terrain from .terraindb database file.” Here is the example you need:

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
    url : 'http://localhost:8002/NagaiOoeRoad',
});

viewer.camera.flyTo({
    destination: Cesium.Rectangle.fromDegrees(137.3286502, 36.342873, 137.3300283, 36.343922),
    endTransform: Cesium.Matrix4.IDENTITY,
    duration: 0.0
});

This assumes your NagaiOoeRoad.terraindb file is in C:/Cesium/_tilesets/Test and that you started the asset server with the path to the Test directory:

../tilers-win/bin/asset-server -d C:/Cesium/_tilesets/Test

Of course, you can use your own directory names.

It’s not possible to fly to terrain in CesiumJS due to limitations of the quantized-mesh format. You will need to fly the camera to a position on the globe manually. Here is the documentation on that: Camera - Cesium Documentation

For terrain, you can use gdalinfo to grab the WGS84 extent from the source data and then use that to construct a rectangle using fromDegrees: Rectangle - Cesium Documentation

The flyTo example script I pasted above shows how to do this and should work for your data.

Matt

1 Like