Creating terrain tiles for a local area #1

Closed
turban opened this Issue Sep 22, 2014 · 3 comments

Projects

None yet

2 participants

@turban
turban commented Sep 22, 2014

Great work!

I've tested the terrain builder and created a tileset for an area in Norway. I also had to create a layer.json file. I'm then adding the terrain with these lines:

  var terrainProvider = new Cesium.CesiumTerrainProvider({
    url: '/terrain/jotunheimen'
  });

  viewer.scene.terrainProvider = terrainProvider;

I'm getting this error:

Failed to obtain terrain tile X: 0 Y: 0 Level: 0

This tile don't exist as it's not where my data is. I'm getting the same error if I first move to my location:

viewer.scene.camera.flyTo({
  destination: Cesium.Cartesian3.fromDegrees(8.4, 61.5, 10000.0),
  duration: 3,
  complete: switchTerrain
});

Do you now how to load terrain tiles for a local area?

@homme
Member
homme commented Sep 22, 2014

I've come across this issue before: it seems that CesiumJS always needs to request the two top level tiles (0/0/0.terrain & 0/1/0.terrain). If your underlying GDAL dataset doesn't overlap the prime meridian then one of those tiles will be missing; if you're rendering Norway it makes sense that it can't find the 0/0/0.terrain tile.

I fixed this by manually copying a terrain tile that happened to be blank to the appropriate place in the terrain output (0/0/0.terrain). You could also get this tile from http://cesiumjs.org/tilesets/terrain/smallterrain/0/0/0.terrain. The only slight problem is that this latter tile will specify the existence of child tiles which won't of course exist, but this is only an optimisation issue really.

It may be worth me adding an option to ctb-tile to control the generation of this top level tile (by default).

@turban
turban commented Sep 22, 2014

Thanks for your quick reply! I also read about it here:
https://groups.google.com/forum/#!msg/cesium-dev/apE83KFxYW8/1xJ5P0qlvNYJ

Do you have an empty tile (with no child tiles) that you could attach to this issue?

@homme homme added a commit that referenced this issue Sep 22, 2014
@homme homme Add a blank terrain tile for use as a root tile in a tileset
Unless the GDAL dataset passed to `ctb-tile` crosses the Prime Meridian one of
either of the root tiles `/0/0/0.terrain` or '/0/0/1.terrain` will be missing.
However, both tiles are required by CesiumJS.  The added tile specifies no child
tiles and can be manually added to the appropriate root tile in a tileset in
order to resolve the problem. See issue #1 for details.
bb9ea94
@homme
Member
homme commented Sep 22, 2014

No problem. The blank tile is available here.

@homme homme closed this Oct 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment