Skip to main content

alcesium-terrain-maker

High-performance GeoTIFF → Cesium quantized-mesh-1.0 terrain tile generator.

Python API + Cython/AVX512 native core(默认开启 AVX512,需 CPU 支持)。GDAL is required at runtime (not bundled in the wheel).

Requirements

  • Python >= 3.11
  • CMake >= 3.22, C++17 compiler, Ninja
  • GDAL >= 3.4 with Python bindings (osgeo)
  • NumPy (build + runtime for tests)

Installing GDAL

Conda (recommended on Windows):

conda install -c conda-forge gdal

Linux:

sudo apt install gdal-bin libgdal-dev python3-gdal

Build & Install

# 安装到当前环境(开发)
uv sync --extra dev
uv pip install -e ".[dev]"

# 打一个 wheel(当前 Python 版本)→ dist/
uv build --wheel --out-dir dist

# Windows:注入 MSVC 后构建(推荐)
.\scripts\build_wheel.ps1

# 全量:Windows 3.11–3.14 + Linux manylinux(需 Docker)
.\scripts\build_local_wheels.ps1

# 上传 PyPI
.\scripts\upload_wheels.ps1

详见 scripts/README.md。

默认 wheel 开启 AVX512(性能优先)。在不支持 AVX512 的老 CPU 上需关闭后重编:

uv build --wheel -Ccmake.define.ATM_USE_AVX512=OFF
# 或仅 AVX2:
uv build --wheel -Ccmake.define.ATM_USE_AVX512=OFF -Ccmake.define.ATM_USE_AVX2=ON
# 或完全可移植(无 SIMD 指令集要求):
uv build --wheel -Ccmake.define.ATM_USE_AVX512=OFF -Ccmake.define.ATM_USE_AVX2=OFF

PowerShell 脚本可加 -Portable:.\scripts\build_wheel.ps1 -Portable

Python API

from pathlib import Path
from alcesium_terrain_maker import TerrainBuilder, TerrainConfig

config = TerrainConfig(
    profile="geodetic",       # or "mercator"
    overlap_mode="MEAN",      # LAST | FIRST | MEAN | MIN | MAX
    buffer_m=500.0,
    buffer_mode="FADE",       # EXTEND | FADE
    max_zoom=14,
    thread_count=16,
)

builder = TerrainBuilder(config)
result = builder.build(
    inputs=[Path("dem_a.tif"), Path("dem_b.tif")],
    output_dir=Path("terrain_out"),
)

print(result.tiles_written, result.layer_json_path)

Multi-GeoTIFF overlap

Each source is sampled independently per tile. Overlap pixels are merged using overlap_mode:

Mode Behavior
LAST Later inputs overwrite earlier
FIRST Earlier values kept where present
MEAN Average of valid values
MIN / MAX Minimum / maximum elevation

Boundary buffer

buffer_m extends each source outward. Applied per-source during tile sampling (not by merging rasters):

  • EXTEND: outer ring height copied from nearest valid edge pixel
  • FADE: linear decay toward 0; pixels originally below 0 stay frozen in the buffer zone

Output layout

terrain_out/
├── layer.json
└── {z}/{x}/{y}.terrain   # gzip-compressed quantized-mesh-1.0

Load in CesiumJS

const viewer = new Cesium.Viewer("cesiumContainer", {
  terrainProvider: await Cesium.CesiumTerrainProvider.fromUrl("./terrain_out/"),
});

Project layout

src/alcesium_terrain_maker/   # Python + Cython sources
extern/zlib/                  # zlib (FetchContent at build time)
extern/mesh_simplify/         # Chunked LOD grid simplification (C++)

Tests

pytest tests/

Performance tips

  • Use COG / tiled GeoTIFF (gdal_translate -co TILED=YES -co BLOCKXSIZE=65)
  • Set thread_count to CPU core count
  • Input elevation should be ellipsoidal heights in meters (WGS84)

Metadata

Release files for alcesium-terrain-maker 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for alcesium-terrain-maker 0.1.1
File Actions
alcesium_terrain_maker-0.1.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for alcesium_terrain_maker-0.1.1-cp314-cp314-win_amd64.whl
alcesium_terrain_maker-0.1.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for alcesium_terrain_maker-0.1.1-cp313-cp313-win_amd64.whl
alcesium_terrain_maker-0.1.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for alcesium_terrain_maker-0.1.1-cp312-cp312-win_amd64.whl
alcesium_terrain_maker-0.1.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for alcesium_terrain_maker-0.1.1-cp311-cp311-win_amd64.whl

Total release size: 1.2 MB

Release files / alcesium_terrain_maker-0.1.1-cp314-cp314-win_amd64.whl

Download URL alcesium_terrain_maker-0.1.1-cp314-cp314-win_amd64.whl
Size 302.1 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
6d3aea06bb4cd3629308a20fd8a414695b3d20eafd528c920eda20befbda2eee
BLAKE2b-256 checksum
How to use checksums
9c0b52385d188702b268633483cdf814830cd0fa6634d62db0aa2d5a22452e63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / alcesium_terrain_maker-0.1.1-cp313-cp313-win_amd64.whl

Download URL alcesium_terrain_maker-0.1.1-cp313-cp313-win_amd64.whl
Size 296.6 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
9f7dc1553eec05ce74d95504ea4b0411757a27226846eaa05097c22bb8df431f
BLAKE2b-256 checksum
How to use checksums
40c4a4aaf84da5469d72e3aea035a73ac8635c018db4ee582f0a19e038c9dd21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / alcesium_terrain_maker-0.1.1-cp312-cp312-win_amd64.whl

Download URL alcesium_terrain_maker-0.1.1-cp312-cp312-win_amd64.whl
Size 296.4 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
e73c5391b6fe9724dc938e985447c0e670aaa993930d0f48e565eb8ff37c9a25
BLAKE2b-256 checksum
How to use checksums
a125d5f3dc5be7bf8e9bb8e4f3d2d1b3e90890ebfbf9f27eadccd4f7e0033670
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / alcesium_terrain_maker-0.1.1-cp311-cp311-win_amd64.whl

Download URL alcesium_terrain_maker-0.1.1-cp311-cp311-win_amd64.whl
Size 298.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
7406707313b608f1dc1153c348199985df2d6ff6a74570213c8e9eb42f79d250
BLAKE2b-256 checksum
How to use checksums
3963de83a08dd9c6ff1738632204f6a9a09f3cb8974a2ae03deab3de4c753f33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for alcesium-terrain-maker 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

4 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page