cesium-terrain-builder
cesium-terrain-builder copied to clipboard
Can not add the terrain data in cesium
-
At first i get the terrain tile use
ctb-tile --output-dir ./terrain-tiles dem.tif
-
The I add the data in tomcat webapp root dir, which as
apache-tomcat-10.0.2\webapps\ROOT\output-dir
-
I add the terrain use
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
url : `http://localhost:8081/output-dir`,
});
-
The world is black and can not see anything
-
The http request have only one for 0/1/0.terrain
I'm facing the same issue. Javascript debugging console reports:
An error occurred in "CesiumTerrainProvider": Failed to obtain terrain tile X: 1 Y: 0 Level: 0.
layers.json and the first tile (zoom level) are loaded fine , http://localhost:8083/data/tin/0/0/0.terrain?v=1.1.0 returns data and corect Content-type
Generated using intput GeoTIFF and -N -C options
Running ctb-info
ctb-info tin7/9/559/395.terrain reports ```Error: File has wrong file size to be a valid terrain
NOTE: It seems I've used different docker image. Will test with homme/cesium-terrain-builder and report. Sorry for disturbance.
I am also getting the same problem with Cesium Terrain Builder with quantized mesh. Please help me on this. I am stuck on this problem for over a month
I'm facing the same issue. Javascript debugging console reports:
An error occurred in "CesiumTerrainProvider": Failed to obtain terrain tile X: 1 Y: 0 Level: 0.
layers.json and the first tile (zoom level) are loaded fine , http://localhost:8083/data/tin/0/0/0.terrain?v=1.1.0 returns data and corect Content-type
Generated using intput GeoTIFF and -N -C options
Running ctb-info
ctb-info tin7/9/559/395.terrain reports ```Error: File has wrong file size to be a valid terrain
NOTE: It seems I've used different docker image. Will test with homme/cesium-terrain-builder and report. Sorry for disturbance.
Any progress on this. I am also getting same error. Cant understand where I did wrong
I've checked the empty tile
issue, as well as tried various ctb-tile
tools. All with the same result. Tiles generated with this tool about 3 years back are working in the new version of Cesium.
I've checked the
empty tile
issue, as well as tried variousctb-tile
tools. All with the same result. Tiles generated with this tool about 3 years back are working in the new version of Cesium
Can you mention which version of Cesium and ctb-tile tools you used? Have you done any settings in tomcat server?
The main reason that you can't load terrain file into cesium is because .terrain
is ziped file, you need to unzip it or tell your browser to do it (by setting response header 'Content-Encoding: gzip')
I can confirm this. Check this for a possible solution: https://stackoverflow.com/questions/54879535/cesium-terrain-builder-docker-error-when-i-load-cesium-js-in-browser/65196056#65196056
I can confirm this. Check this for a possible solution: https://stackoverflow.com/questions/54879535/cesium-terrain-builder-docker-error-when-i-load-cesium-js-in-browser/65196056#65196056
Sadly the problem still persists for me although the Content-Encoding is correctly set to gzip and the Content-Type to application/octet-stream. The error message in the console using chrome is:
RangeError: Invalid typed array length: 4225
I tried it both with a dataset in float32 and UInt16. The layer.json can also be loaded.
I am using geo-data/cesium-terrain-server as server.
EDIT: I found the problem, the terrain sever removes for some reason the available array from the layer.json.
For testing, I fixed it by hard coding it into the node_modules/cesium/Source/Core/CesiumTerrainProvider.js
file in the parseMetadataSuccess
method
I got the same problem
I use docker container cesium-terrain-builder to generate terrain tiles (ctb-tile -f Mesh -C -N -v -o ./terrain/ ./XXX.vrt) , then use cesium-terrain-server to server terrain tiles, a cesium client error occurs :
An error occurred in "CesiumTerrainProvider": Failed to obtain terrain tile X: 0 Y: 0 Level: 0. Error message: "RangeError: Invalid typed array length: 4225"
finally,i found .terrain file is compressed (gzip), then use nginx to server it :
location /{ alias d:/terrain/; add_header Access-Control-Allow-Origin ; add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; location ~ .terrain$ { add_header Content-Disposition 'attachment;filename=$arg_filename'; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; add_header Content-Encoding "gzip"; add_header Content-Type "application/octet-stream"; } }
then solved it ! I am sure this is the key point :
location ~* .terrain$ { add_header Content-Encoding gzip; }
reference: Cesium-terrain-builder-docker error when i load cesium.js in browser
@Gitwinters1973 May i know if the quantized-mesh produced by the docker CTB has metadata extension in 0/0/0.terrain and 0/1/0.terrain? I used CTB by this fork https://github.com/ahuarte47/cesium-terrain-builder/tree/master-quantized-mesh,the quantized-mesh has no metadata extension,only can i get is layer.json,i guess there has some bug.
Hey there, cesium-terrain-builder-docker is built from the latest commit on https://github.com/geo-data/cesium-terrain-builder/pull/64. Check the PR for all features included.