├── .dockerignore ├── .github └── workflows │ └── docker.yml ├── .gitignore ├── Dockerfile ├── Dockerfile.alpine ├── LICENSE └── README.md /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .vscode 3 | README.md 4 | LICENSE 5 | .gitignore 6 | .github/ 7 | -------------------------------------------------------------------------------- /.github/workflows/docker.yml: -------------------------------------------------------------------------------- 1 | name: docker-build-edge 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | paths: 9 | - Dockerfile 10 | - Dockerfile.alpine 11 | 12 | env: 13 | REGISTRY: ghcr.io 14 | IMAGE_NAME: tum-gis/ctb-quantized-mesh 15 | 16 | jobs: 17 | build-debian: 18 | 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - 23 | name: Checkout repo 24 | uses: actions/checkout@v3 25 | - 26 | name: Log in to the Github Container Registry 27 | uses: docker/login-action@v2 28 | with: 29 | registry: ${{ env.REGISTRY }} 30 | username: ${{ github.actor }} 31 | password: ${{ secrets.GITHUB_TOKEN }} 32 | - 33 | name: Log in to Dockerhub 34 | uses: docker/login-action@v2 35 | with: 36 | username: ${{ secrets.DOCKERHUB_USERNAME }} 37 | password: ${{ secrets.DOCKERHUB_TOKEN }} 38 | - 39 | name: Set up QEMU 40 | uses: docker/setup-qemu-action@v2 41 | with: 42 | platforms: linux/amd64,linux/arm64 43 | - 44 | name: Set up Docker Buildx 45 | uses: docker/setup-buildx-action@v2 46 | - 47 | name: Extract metadata (tags, labels) for docker image - Debian 48 | id: meta 49 | uses: docker/metadata-action@v4 50 | with: 51 | images: | 52 | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 53 | tumgis/ctb-quantized-mesh 54 | tags: | 55 | type=raw,value=latest 56 | labels: | 57 | maintainer=Chair of Geoinformatics, Technical University of Munich (TUM) 58 | org.opencontainers.image.vendor=Chair of Geoinformatics, Technical University of Munich (TUM) 59 | org.opencontainers.image.title=ctb-quantized-mesh 60 | - 61 | name: Build and publish ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - Debian 62 | uses: docker/build-push-action@v4 63 | with: 64 | push: true 65 | tags: ${{ steps.meta.outputs.tags }} 66 | labels: ${{ steps.meta.outputs.labels }} 67 | platforms: linux/amd64,linux/arm64 68 | 69 | build-alpine: 70 | 71 | runs-on: ubuntu-latest 72 | 73 | steps: 74 | - 75 | name: Checkout repo 76 | uses: actions/checkout@v3 77 | - 78 | name: Log in to the Github Container Registry 79 | uses: docker/login-action@v2 80 | with: 81 | registry: ${{ env.REGISTRY }} 82 | username: ${{ github.actor }} 83 | password: ${{ secrets.GITHUB_TOKEN }} 84 | - 85 | name: Log in to Dockerhub 86 | uses: docker/login-action@v2 87 | with: 88 | username: ${{ secrets.DOCKERHUB_USERNAME }} 89 | password: ${{ secrets.DOCKERHUB_TOKEN }} 90 | - 91 | name: Set up QEMU 92 | uses: docker/setup-qemu-action@v2 93 | with: 94 | platforms: linux/amd64,linux/arm64 95 | - 96 | name: Set up Docker Buildx 97 | uses: docker/setup-buildx-action@v2 98 | 99 | - 100 | name: Extract metadata (tags, labels) for docker image - Alpine 101 | id: meta-alpine 102 | uses: docker/metadata-action@v4 103 | with: 104 | images: | 105 | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 106 | tumgis/ctb-quantized-mesh 107 | tags: | 108 | type=raw,value=alpine 109 | labels: | 110 | maintainer=Chair of Geoinformatics, Technical University of Munich (TUM) 111 | org.opencontainers.image.vendor=Chair of Geoinformatics, Technical University of Munich (TUM) 112 | org.opencontainers.image.title=ctb-quantized-mesh 113 | - 114 | name: Build and publish ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - Alpine 115 | uses: docker/build-push-action@v4 116 | with: 117 | push: true 118 | tags: ${{ steps.meta-alpine.outputs.tags }} 119 | labels: ${{ steps.meta-alpine.outputs.labels }} 120 | platforms: linux/amd64,linux/arm64 121 | file: Dockerfile.alpine 122 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Fetch stage ################################################################# 2 | FROM debian:buster AS fetchstage 3 | ARG FETCH_PACKAGES='git ca-certificates' 4 | WORKDIR /ctbtemp 5 | 6 | # Setup fetch packages 7 | RUN set -x && apt-get update && \ 8 | apt-get install -y --no-install-recommends $FETCH_PACKAGES 9 | 10 | # Fetch 11 | RUN set -x && \ 12 | git clone -b master-quantized-mesh --depth 1 \ 13 | https://github.com/ahuarte47/cesium-terrain-builder.git && \ 14 | cd cesium-terrain-builder 15 | 16 | # Build stage ################################################################# 17 | FROM debian:buster AS buildstage 18 | ARG BUILD_PACKAGES='cmake build-essential libgdal-dev' 19 | COPY --from=fetchstage /ctbtemp/cesium-terrain-builder /ctbtemp/cesium-terrain-builder 20 | WORKDIR /ctbtemp/cesium-terrain-builder 21 | 22 | # Steup build packages 23 | RUN set -x && \ 24 | apt-get update && \ 25 | apt-get install -y --no-install-recommends $BUILD_PACKAGES 26 | 27 | # Build & install cesium terrain builder 28 | RUN set -x && \ 29 | ls -lahF && \ 30 | mkdir build && cd build && cmake .. && make install . 31 | 32 | # Cleanup 33 | RUN set -x && \ 34 | apt-get purge -y --auto-remove $BUILD_PACKAGES && \ 35 | rm -rf /var/lib/apt/lists/* && \ 36 | rm -rf /tmp/* && \ 37 | rm -rf /ctbtemp 38 | 39 | # Runtime stage ############################################################### 40 | FROM debian:buster-slim 41 | ARG RUNTIME_PACKAGES='gdal-bin' 42 | COPY --from=buildstage /usr/local/include/ctb /usr/local/include/ctb 43 | COPY --from=buildstage /usr/local/lib/libctb.so /usr/local/lib/libctb.so 44 | COPY --from=buildstage /usr/local/bin/ctb-* /usr/local/bin/ 45 | WORKDIR /data 46 | 47 | # Setup runtime packages and env 48 | RUN set -x && apt-get update && \ 49 | apt-get install -y --no-install-recommends $RUNTIME_PACKAGES && \ 50 | ldconfig && \ 51 | echo 'shopt -s globstar' >> ~/.bashrc && \ 52 | echo 'alias ..="cd .."' >> ~/.bashrc && \ 53 | echo 'alias l="ls -CF --group-directories-first --color=auto"' >> ~/.bashrc && \ 54 | echo 'alias ll="ls -lFh --group-directories-first --color=auto"' >> ~/.bashrc && \ 55 | echo 'alias lla="ls -laFh --group-directories-first --color=auto"' >> ~/.bashrc 56 | 57 | CMD ["bash"] 58 | 59 | # Labels ###################################################################### 60 | LABEL maintainer="Bruno Willenborg" 61 | LABEL maintainer.email="b.willenborg(at)tum.de" 62 | LABEL maintainer.organization="Chair of Geoinformatics, Technical University of Munich (TUM)" 63 | LABEL source.repo="https://github.com/tum-gis/https://github.com/tum-gis/cesium-terrain-builder-docker" 64 | LABEL docker.image="tumgis/ctb-quantized-mesh" 65 | -------------------------------------------------------------------------------- /Dockerfile.alpine: -------------------------------------------------------------------------------- 1 | # Fetch stage ################################################################# 2 | FROM alpine:3.17 AS fetchstage 3 | 4 | # Setup fetch deps 5 | RUN set -ex && \ 6 | apk update && \ 7 | apk add --no-cache --virtual .fetch-deps git 8 | 9 | # Fetch source code 10 | RUN set -x && \ 11 | mkdir -p ctbtemp && cd ctbtemp && \ 12 | git clone -b master-quantized-mesh --depth 1 \ 13 | https://github.com/ahuarte47/cesium-terrain-builder.git && \ 14 | cd cesium-terrain-builder 15 | 16 | # Cleanup 17 | RUN set -x && \ 18 | apk del .fetch-deps 19 | 20 | # Build stage ################################################################# 21 | FROM alpine:3.12 AS buildstage 22 | COPY --from=fetchstage /ctbtemp /ctbtemp 23 | 24 | ARG gdal_version='3.1.4-r4' 25 | ENV GDAL_VERSION=${gdal_version} 26 | 27 | # Setup build deps 28 | RUN set -ex && \ 29 | apk update && \ 30 | apk add --no-cache --virtual .build-deps \ 31 | make cmake libxml2-dev g++ gdal-dev 32 | 33 | # Build & install cesium terrain builder 34 | RUN set -x && \ 35 | cd /ctbtemp/cesium-terrain-builder && \ 36 | mkdir build && cd build && cmake .. && make install . 37 | 38 | # Cleanup 39 | RUN set -x && \ 40 | apk del .build-deps && \ 41 | rm -rf /tmp/* && \ 42 | rm -rf /ctbtemp 43 | 44 | # Runtime stage ######################################################################### 45 | FROM alpine:3.12 AS runtimestage 46 | COPY --from=buildstage /usr/local/include/ctb /usr/local/include/ctb 47 | COPY --from=buildstage /usr/local/lib/libctb.so /usr/local/lib/libctb.so 48 | COPY --from=buildstage /usr/local/bin/ctb-* /usr/local/bin/ 49 | 50 | ARG gdal_version='3.1.4-r0' 51 | ENV GDAL_VERSION=${gdal_version} 52 | 53 | WORKDIR /data 54 | 55 | # Setup runtime deps 56 | RUN set -ex && \ 57 | apk update && \ 58 | apk add --no-cache --virtual .rundeps \ 59 | bash gdal=$GDAL_VERSION gdal-tools=$GDAL_VERSION && \ 60 | echo 'shopt -s globstar' >> ~/.bashrc && \ 61 | echo 'alias ..="cd .."' >> ~/.bashrc && \ 62 | echo 'alias l="ls -CF --group-directories-first --color=auto"' >> ~/.bashrc && \ 63 | echo 'alias ll="ls -lFh --group-directories-first --color=auto"' >> ~/.bashrc && \ 64 | echo 'alias lla="ls -laFh --group-directories-first --color=auto"' >> ~/.bashrc && \ 65 | rm -rf /tmp/* 66 | 67 | CMD ["bash"] 68 | 69 | # Labels ###################################################################### 70 | LABEL maintainer="Bruno Willenborg" 71 | LABEL maintainer.email="b.willenborg(at)tum.de" 72 | LABEL maintainer.organization="Chair of Geoinformatics, Technical University of Munich (TUM)" 73 | LABEL source.repo="https://github.com/tum-gis/cesium-terrain-builder-docker" 74 | LABEL docker.image="tumgis/ctb-quantized-mesh" 75 | LABEL docker.image.tag "alpine" 76 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cesium Terrain Builder Docker 2 | 3 | This repo contains a `Dockerfile` for the [Cesum Terrain Builder (CTB)](https://github.com/geo-data/cesium-terrain-builder) 4 | app with support for the new Cesium terrain format *quantized-mesh*. It is build from a 5 | [fork](https://github.com/ahuarte47/cesium-terrain-builder/tree/master-quantized-mesh) 6 | providing quantized-mesh support, as described in this 7 | [artice](https://www.linkedin.com/pulse/fast-cesium-terrain-rendering-new-quantized-mesh-output-alvaro-huarte/). 8 | Information on the most recent development of this fork is available in this 9 | [pull request](https://github.com/geo-data/cesium-terrain-builder/pull/64). 10 | Thanks to [@homme](https://github.com/homme) and [@ahuarte47](https://github.com/ahuarte47) 11 | for the great work on Cesium Terrain Builder and quantized-mesh support. 12 | 13 | > **Note:** The images are manually rebuild, when new commits are published at 14 | > [ahuarte47/cesium-terrain-builder/tree/master-quantized-mesh](https://github.com/ahuarte47/cesium-terrain-builder/tree/master-quantized-mesh). 15 | > If you miss an update in an image, please let us know by creating an 16 | > [issue](https://github.com/tum-gis/cesium-terrain-builder-docker/issues). 17 | 18 | If you experience problems or want to contribute please create an 19 | [issue](https://github.com/tum-gis/cesium-terrain-builder-docker/issues) 20 | or [pull request](https://github.com/tum-gis/cesium-terrain-builder-docker/pulls). 21 | 22 | Follow the steps below to create your own quantized-mesh tiles for Cesium using this Docker image. 23 | 24 | ## News 25 | 26 | * 2023-08-06: 27 | * The additional `arm64` image ins now available from both 28 | [Dockerhub](https://hub.docker.com/r/tumgis/ctb-quantized-mesh) and 29 | [Github packages](https://github.com/tum-gis/cesium-terrain-builder-docker/pkgs/container/ctb-quantized-mesh). 30 | 31 | `docker pull ghcr.io/tum-gis/ctb-quantized-mesh:latest` 32 | 33 | `docker pull ghcr.io/tum-gis/ctb-quantized-mesh:alpine` 34 | 35 | * 2023-07-31: 36 | * An additional `arm64` version of the image was added. This currently untested and I'm happy for 37 | any feedback on this, see tum-gis/cesium-terrain-builder-docker#19. The `arm64` Docker images are hosted in 38 | [Github packages](https://github.com/tum-gis/cesium-terrain-builder-docker/pkgs/container/ctb-quantized-mesh). 39 | 40 | `docker pull ghcr.io/tum-gis/ctb-quantized-mesh:latest` 41 | 42 | `docker pull ghcr.io/tum-gis/ctb-quantized-mesh:alpine` 43 | 44 | * 2023-03-06: 45 | 46 | * Updated both images to reflect latest changes in 47 | [ahuarte47/cesium-terrain-builder:master-quantized-mesh](https://github.com/ahuarte47/cesium-terrain-builder/tree/master-quantized-mesh) 48 | * Updated GDAL to 2.4.0 in `latest` image 49 | 50 | * 2020-11: Updated ``alpine`` image to Alpine v3.12 and GDAL v3.14 51 | 52 | * 2020-11: Reduced size of all images using multi stage builds. 53 | 54 | ## Image variants 55 | 56 | The `amd64` Docker images are available on DockerHub from [tumgis](https://hub.docker.com/r/tumgis/) or from 57 | [Github packages](https://github.com/tum-gis/cesium-terrain-builder-docker/pkgs/container/ctb-quantized-mesh). 58 | To get the image run: 59 | 60 | `docker pull tumgis/ctb-quantized-mesh:` or 61 | `docker pull ghcr.io/tum-gis/ctb-quantized-mesh:` 62 | 63 | The `arm64` Docker images are ONLY available from 64 | [Github packages](https://github.com/tum-gis/cesium-terrain-builder-docker/pkgs/container/ctb-quantized-mesh). 65 | To get the image run: 66 | 67 | `docker pull ghcr.io/tum-gis/ctb-quantized-mesh:` 68 | 69 | Following tags are available: 70 | 71 | | Tag | Build status | Arch | Description | 72 | |------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|-----------------|---------------------------------------------------------------| 73 | | ``latest`` | [![Build Status](https://travis-ci.com/tum-gis/cesium-terrain-builder-docker.svg?branch=master)](https://travis-ci.com/tum-gis/cesium-terrain-builder-docker) ![Build status](https://img.shields.io/github/actions/workflow/status/tum-gis/cesium-terrain-builder-docker/docker.yml?logo=docker) | `amd64` `arm64` | Latest image build based on Debian and GDAL 2.4.0 | 74 | | ``alpine`` | [![Build Status](https://travis-ci.com/tum-gis/cesium-terrain-builder-docker.svg?branch=alpine)](https://travis-ci.com/tum-gis/cesium-terrain-builder-docker) ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/tum-gis/cesium-terrain-builder-docker/docker.yml?logo=docker) | `amd64` `arm64` | Image based on leightweight Alpine Linux v3.12 and GDAL v3.14 | 75 | 76 | ## Content 77 | 78 | - [Cesium Terrain Builder Docker](#cesium-terrain-builder-docker) 79 | - [News](#news) 80 | - [Image variants](#image-variants) 81 | - [Content](#content) 82 | - [Preparation](#preparation) 83 | - [Docker settings](#docker-settings) 84 | - [Data pre-processing](#data-pre-processing) 85 | - [Data storage](#data-storage) 86 | - [Cesium Terrain Builder usage](#cesium-terrain-builder-usage) 87 | - [Start CTB container and mount data folder](#start-ctb-container-and-mount-data-folder) 88 | - [Linux - `bash`](#linux---bash) 89 | - [Windows - `cmd`](#windows---cmd) 90 | - [Windows - `git-bash`](#windows---git-bash) 91 | - [Windows - `powershell`](#windows---powershell) 92 | - [Create a GDAL Virtual Dataset (optional)](#create-a-gdal-virtual-dataset-optional) 93 | - [Create Cesium Terrain files](#create-cesium-terrain-files) 94 | - [Create Cesium layer description file](#create-cesium-layer-description-file) 95 | - [Troubleshooting](#troubleshooting) 96 | - [Performance issues](#performance-issues) 97 | - [Handling large datasets](#handling-large-datasets) 98 | 99 | ## Preparation 100 | 101 | ### Docker settings 102 | 103 | The system resources Docker can use are limited by default on Windows systems. 104 | Goto *Docker tray Icon* -> *Settings* -> *Advanced* to adjust the *number of cores* 105 | and *main memory* Docker can use to increase performance. 106 | 107 | ### Data pre-processing 108 | 109 | It is highly recommended (but not required) to transform your data to the 110 | *WGS84* (EPSG:4326) coordinate reference system before using CTB. This helps to avoid 111 | vertial or horizontal offsets of terrain datasets. Use the `NTv2` transformation method 112 | if available. This is e.g. supported by [FME](https://www.safe.com/) 113 | using the `EsriReprojector` transformer or [ESRI ArcGIS](https://www.arcgis.com/index.html). 114 | 115 | ### Data storage 116 | 117 | Put your data in a folder, that can be mounted by Docker. On Windows, 118 | you will have to grant access to the drive where the data is located 119 | before being able to mount the folder. Goto *Docker tray Icon* -> *Settings* -> 120 | *Shared Drives* to share drives with Docker. Visit this 121 | [blog post](https://rominirani.com/docker-on-windows-mounting-host-directories-d96f3f056a2c) 122 | for a comprehensive guide on mounting host directories on Windows. 123 | 124 | In the following we assume that your terrain data is stored in `d:\docker\terrain` 125 | for a Windows Docker host and drive `d:\` is shared with Docker. 126 | For a Linux Docker host we assume your data is stored in `/docker/terrain`. 127 | 128 | ## Cesium Terrain Builder usage 129 | 130 | When your data is transformed and copied to a location available for Docker your 131 | are ready for creating a Cesium terrain with CTB. 132 | 133 | ### Start CTB container and mount data folder 134 | 135 | Before starting CTB it is recommended to pull the latest image version using 136 | `docker pull tumgis/ctb-quantized-mesh`. 137 | After that, start a CTB container and mount your terrain data folder to `/data` in the container. 138 | Follow the examples below for different operating systems and shells. 139 | 140 | #### Linux - `bash` 141 | 142 | ```bash 143 | docker run -it --name ctb \ 144 | -v "/docker/terrain:/data" \ 145 | tumgis/ctb-quantized-mesh 146 | ``` 147 | 148 | #### Windows - `cmd` 149 | 150 | ```sh 151 | docker run -it --name ctb ^ 152 | -v "d:/docker/terrain:/data" ^ 153 | tumgis/ctb-quantized-mesh 154 | ``` 155 | 156 | #### Windows - `git-bash` 157 | 158 | ```sh 159 | winpty docker run --rm -it --name ctb \ 160 | -v "d:\\docker\\terrain:/data" \ 161 | tumgis/ctb-quantized-mesh 162 | ``` 163 | 164 | #### Windows - `powershell` 165 | 166 | ```powershell 167 | docker run -it --name ctb ` 168 | -v "d:\docker\terrain:/data" ` 169 | tumgis/ctb-quantized-mesh 170 | ``` 171 | 172 | ### Create a GDAL Virtual Dataset (optional) 173 | 174 | If you dataset consists of a single file, continue to the next step. 175 | If your dataset consists of multiple tiles (more than one file), a 176 | *GDAL Virtual Dataset* needs to be created using the `gdalbuildvrt` app. 177 | 178 | ```sh 179 | gdalbuildvrt 180 | ``` 181 | 182 | For instance, if you have several `*.tif` files, run: 183 | 184 | ```sh 185 | gdalbuildvrt tiles.vrt *.tif 186 | ``` 187 | 188 | More options to create a *GDAL Virtual Dataset* e.g. using a *list of files* are 189 | described in the [gdalbuildvrt documentation](https://www.gdal.org/gdalbuildvrt.html). 190 | 191 | ### Create Cesium Terrain files 192 | 193 | First, create an output folder for you terrain, e.g. `mkdir -p terrain`. 194 | Second, run CTB to create the terrain files: 195 | 196 | ```sh 197 | ctb-tile -f Mesh -C -N -o terrain 198 | ``` 199 | 200 | For example, if a `tile.vrt` has been created as described above: 201 | 202 | ```sh 203 | ctb-tile -f Mesh -C -N -o terrain tile.vrt 204 | ``` 205 | 206 | The `ctb-tile` app supports several options. Run `ctb-tile --help` to display all options. 207 | For larger datasets consider setting the `-m` option and the `GDAL_CHACHEMAX` environment 208 | variable as described [here](https://github.com/geo-data/cesium-terrain-builder#ctb-tile). 209 | 210 | ### Create Cesium layer description file 211 | 212 | Finally, a *layer description* file needs to be created. Simply run the same 213 | command you used for creating the terrain files again adding the `-l` switch. For instance: 214 | 215 | ```sh 216 | ctb-tile -f Mesh -C -N -o terrain tiles.vrt # Create terrain files 217 | ctb-tile -f Mesh -C -N -l -o terrain tiles.vrt # Create layer description file 218 | ``` 219 | 220 | Finally, your terrain data folder should look similar to this: 221 | 222 | ```text 223 | $ tree -v -C -L 1 terrain/ 224 | terrain/ 225 | |-- 0 226 | |-- 1 227 | |-- 2 228 | |-- 3 229 | |-- 4 230 | |-- 5 231 | |-- 6 232 | |-- 7 233 | |-- 8 234 | |-- 9 235 | |-- 10 236 | |-- 11 237 | |-- 12 238 | |-- 13 239 | |-- 14 240 | |-- 15 241 | `-- layer.json 242 | ``` 243 | 244 | The quantized-mesh terrain is now ready for usage. 245 | 246 | ## Troubleshooting 247 | 248 | ### Performance issues 249 | 250 | Read the [recommendations](https://github.com/geo-data/cesium-terrain-builder#recommendations) for `ctb-tile` 251 | carefully, especially when handling large datasets. 252 | 253 | ### Handling large datasets 254 | 255 | Datasets with a big extent can lead to overflow errors on lower zoom levels: 256 | 257 | ```text 258 | 0...10...20...30...40...50...60...70...80...90...ERROR 1: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 259 | ERROR 1: IReadBlock failed at X offset 0, Y offset 0: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 260 | ERROR 1: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 261 | ERROR 1: IReadBlock failed at X offset 0, Y offset 0: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 262 | ERROR 1: IReadBlock failed at X offset 0, Y offset 0: IReadBlock failed at X offset 0, Y offset 0: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 263 | ERROR 1: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 264 | ERROR 1: IReadBlock failed at X offset 0, Y offset 0: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 265 | ERROR 1: IReadBlock failed at X offset 0, Y offset 0: IReadBlock failed at X offset 0, Y offset 0: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 266 | ERROR 1: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 267 | ERROR 1: IReadBlock failed at X offset 0, Y offset 0: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 268 | ERROR 1: IReadBlock failed at X offset 0, Y offset 0: IReadBlock failed at X offset 0, Y offset 0: Integer overflow : nSrcXSize=41494, nSrcYSize=16585 269 | ``` 270 | 271 | As described [here](https://github.com/tum-gis/cesium-terrain-builder-docker/issues/3#issuecomment-772680266), 272 | this is caused by GDAL trying to create overviews from input data. 273 | A possible solution is to create simplified versions of the input data with lower resolutions and use them 274 | for creating the mesh tiles on lower levels. 275 | This can be done using e.g. [gdal_translate](https://gdal.org/programs/gdal_translate.html). 276 | After that, try to create mesh tiles using `ctb-tile` with the resolutions that do not crash starting from 277 | level 0. 278 | Try to use the highest resolution possible that does not crash for each level. 279 | --------------------------------------------------------------------------------