# cesium-terrain-builder
**Repository Path**: mirrors-gis/cesium-terrain-builder
## Basic Information
- **Project Name**: cesium-terrain-builder
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-09-27
- **Last Updated**: 2024-09-27
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Cesium Terrain Builder
This is a C++ library and associated command line tools designed to create
terrain tiles for use with the [Cesium JavaScript](http://cesiumjs.org) library.
Cesium can create interactive 3D globes (à la Google Earth) in your web browser
whereby imagery is draped over a model of the underlying terrain. Cesium
provides a number of
[different sources](http://cesiumjs.org/2013/02/15/Cesium-Terrain-Tutorial) for
the terrain data, one of which is height map data for use with the
[`CesiumTerrainProvider`](http://cesiumjs.org/Cesium/Build/Documentation/CesiumTerrainProvider.html)
JavaScript class.
Cesium Terrain Builder can be used to create the tilesets that sit behind a
terrain server used by `CesiumTerrainProvider`. Note that these tools do *not*
provide a way of serving up those tilesets to the browser: instead
[Cesium Terrain Server](https://github.com/geo-data/cesium-terrain-server) is
designed to serve terrain tilesets. In particular the Docker
[geodata/cesium-terrain-server](https://registry.hub.docker.com/u/geodata/cesium-terrain-server/)
image is designed to simplify the visualisation of terrain tilesets.
## Command Line Tools
The following tools are built on top of the C++ `libctb` library:
### `ctb-tile`
This creates gzipped terrain tiles from a GDAL raster representing a
[Digital Elevation Model](http://en.wikipedia.org/wiki/Digital_elevation_model)
(DEM), saving the resulting tiles to a directory. It calculates the maximum
zoom level concomitant with the native raster resolution and creates terrain
tiles for all zoom levels between that maximum and zoom level `0` where the
tile extents overlap the raster extents, resampling and subsetting the data as
necessary. E.g.
ctb-tile --output-dir ./terrain-tiles dem.tif
The input raster should contain data representing elevations relative to sea
level. `NODATA` (null) values are not currently dealt with: these should be
filled using interpolation in a data preprocessing step.
Note that in the case of multiband rasters, only the first band is used as the
input DEM.
As well as creating terrain tiles, the tool can also be used for generating
tiles in GDAL supported formats using the `--output-format` option. This
provides similar functionality to the
[`gdal2tiles.py`](http://www.gdal.org/gdal2tiles.html) script. Tiles can be
created in either Web Mercator or Global Geodetic projections using the
`--profile` option. e.g.
ctb-tile --output-format JPEG --profile mercator \
--output-dir ./jpeg-tiles RGB-image.tif
An interesting variation on this is to specify `--output-format VRT` in order to
generate GDAL Virtual Rasters: these can be useful for debugging and are easily
modified programatically.
```
Usage: ctb-tile [options] GDAL_DATASOURCE
Options:
-V, --version output program version
-h, --help output help information
-o, --output-dir
specify the output directory for the tiles (defaults to working directory)
-f, --output-format specify the output format for the tiles. This is either `Terrain` (the default) or any format listed by `gdalinfo --formats`
-p, --profile specify the TMS profile for the tiles. This is either `geodetic` (the default) or `mercator`
-c, --thread-count specify the number of threads to use for tile generation. On multicore machines this defaults to the number of CPUs
-t, --tile-size specify the size of the tiles in pixels. This defaults to 65 for terrain tiles and 256 for other GDAL formats
-s, --start-zoom specify the zoom level to start at. This should be greater than the end zoom level
-e, --end-zoom specify the zoom level to end at. This should be less than the start zoom level and >= 0
-r, --resampling-method specify the raster resampling algorithm. One of: nearest; bilinear; cubic; cubicspline; lanczos; average; mode; max; min; med; q1; q3. Defaults to average.
-n, --creation-option