Creating Tiles

Mapping

Written By Mick Simpson ()

Updated at August 25th, 2021

NOTE

Cesium requires the following: “Terrain tiles are served gzipped. Once extracted, they are at least 8,452 bytes in size. The first and most important part of the file is a simple array of 16-bit, little-endian, integer heights arranged from north to south and from west to east - the first 2 bytes are the height in the northwest corner, and the next 2 bytes are the height at the location just to the east of there. Each height is the number of 1/5 meter units above -1000 meters. The total size of the post data is 65 * 65 * 2 = 8450 bytes.”

http://cesiumjs.org/data-and-assets/terrain/formats/heightmap-1.0.html

# Compress a geotiff:

gdal_translate -co COMPRESS=JPEG -co TILED=YES worsley.tif worsleycompressed.tif


# install the leaflet version of gdal2tiles from:

https://github.com/commenthol/gdal2tiles-leaflet


# Generate tileset from geotiff:

gdal2tiles-multiprocess.py -e -z 7-18 -a 0,0,0 Worsley.tif /var/www/html/maps/worsley/


# Compress a tile directory into 200MB chunks:

tar cvzf - worsley/ | split –bytes=200MB - worsley_highres.tar.gz.


# Decompress the chunks:

cat worsley_highres.tar.gz.* | tar xzv


# Copy the files from one machine to another:

rsync -hrPtz –ignore-existing ./fmg/ ftp@10.243.203.18:tiles/