javascript - Unable to serve.terrain files in cesium sandcastle -
i learning 3d terrain generation using cesiumjs. generated .terrain files usind cesium terrain builder , kept them in 'cesium/apps' directory testing purposes , avoid cors issues. whenever, try generate terrain error tile @ x:0 y:0 level 0 tile @ x:1 y:0 level 0 not found though added empty files @ specified locations.
this older question, stumbled upon throughout research i'll detail bit.
after you've managed generate terrain tiles, obvious @ time option serve them https://github.com/geo-data/cesium-terrain-server. server written in go requires go present on system. build intention ease development , testing of terrain tiles created cesium terrain builder tools.
my own objective serve .terrain
tiles apache server , turned out pretty easy, after inspecting in fiddler cesium-terrain-server serving , after finding exchange of messages (look kevin ring's reply).
besides cors, terrain files need have mime type application/octet-stream
, if gzipped content-encoding: gzip
. careful, pass gzip
header don't gzip
files served again if gzipped.
in .htaccess
have following new lines in place:
<ifmodule mod_headers.c> header set access-control-allow-origin "*" </ifmodule> <filesmatch "(.*)\.terrain$"> forcetype application/octet-stream header set content-disposition attachment header set content-encoding: gzip </filesmatch>
what needed add layer.json
file in root of terrain folder, following content:
{ "tilejson": "2.1.0", "format": "heightmap-1.0", "version": "1.0.0", "scheme": "tms", "tiles": ["{z}/{x}/{y}.terrain"] }
now works intended.
Comments
Post a Comment