Last active
July 30, 2022 23:55
-
-
Save typebrook/67c51de17a50fed3c8857451a58a79be to your computer and use it in GitHub Desktop.
Command to generate Cesium terrain tiles with ctb-tile #cesium #tile #makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check command ctb-tile at | |
# https://github.com/geo-data/cesium-terrain-builder | |
# https://github.com/tum-gis/cesium-terrain-builder-docker | |
, | |
.ONESHELL: | |
ZIP_URL = http://dtm.moi.gov.tw/不分幅_全台及澎湖.zip | |
DOCKER_IMAGE = "tumgis/ctb-quantized-mesh:latest" | |
data.zip: | |
<<<"$(ZIP_URL)" perl -lpe 's/([^A-Za-z0-9.\/:])/sprintf("%%%02X", ord($$1))/seg' |\ | |
xargs curl -Lo $@ | |
dem_20m.tif: data.zip | |
unzip -p $< $@ >$@ | |
dem_20m_EPSG4326.tif: dem_20m.tif | |
gdalwarp \ | |
-t_srs EPSG:4326 \ | |
-dstnodata None \ | |
-co TILED=YES \ | |
-co COMPRESS=DEFLATE \ | |
-co BIGTIFF=IF_NEEDED \ | |
$< $@ | |
tiles/: dem_20m_EPSG4326.tif | |
docker image inspect $(DOCKER_IMAGE) >/dev/null || docker pull $(DOCKER_IAMGE) | |
mkdir -p $@ | |
docker run --rm -it \ | |
--name ctb \ | |
-v `pwd`:"/data" \ | |
$(DOCKER_IMAGE) \ | |
ctb-tile -f Mesh -CN --output-dir /data/$@ /data/$< | |
docker run --rm -it \ | |
--name ctb \ | |
-v `pwd`:"/data" \ | |
$(DOCKER_IMAGE) \ | |
ctb-tile -f Mesh -CN -l --output-dir /data/$@ /data/$< | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment