Skip to content

feat: Add Tianditu (TDT) label and terrain support - #225

Open
zishang520 wants to merge 1 commit into
dvt3d:masterfrom
zishang520:feat/tianditu-services
Open

zishang520 wants to merge 1 commit into
dvt3d:masterfrom
zishang520:feat/tianditu-services

Conversation

@zishang520

Copy link
Copy Markdown
Contributor

Add Tianditu DEM terrain and 3D place-name support to dc-sdk, while improving the existing Tianditu imagery services. The implementation follows the project's existing TerrainFactory, layer lifecycle, and module export conventions.

Main Changes

  • Added TerrainType.TDT and TerrainFactory.createTdtTerrain(), with support for Tianditu DEM requests, decompression, and elevation resampling.
  • Added TdtLabelLayer, supporting POI text, icons, and optional road labels, with server-side styling, priority-based collision avoidance, show/hide controls, clear/refresh operations, and remove/re-add lifecycle support.
  • Updated the default imagery endpoints to HTTPS WMTS, with support for seven map service types and both c and w projections, and corrected the mapping between service levels and tile grids.
  • Terrain decoding now uses workers started on demand, with bounded concurrency and transferable ArrayBuffers. Beyond the service's maximum level, Cesium workers are reused to clip terrain meshes, reducing redundant computation on the main thread.
  • Place-name loading now uses bounded caching and request scheduling, batches entity updates, and caches text bounds and ground-clamped positions. It also handles low-angle text clipping and prevents labels on the far side of the globe from being displayed incorrectly.
  • Extended the build pipeline to compile src/workers entry points and copy the required resources, with improved async task handling, temporary-file cleanup, and development watch support.
  • Added pako and protobufjs dependencies, expanded the API documentation and terrain examples, and updated the Tianditu examples to require users to provide their own Key.

Validation

  • Completed local ESLint and Prettier checks, as well as IIFE, ESM, and SCSS build verification.
  • Completed regression testing for data parsing, request scheduling, layer lifecycle, terrain sampling, and worker builds.
  • Completed browser regression testing across different DPR settings, worker loading and failure fallback, label collision avoidance, and repeated layer mounting scenarios.
  • Regression scripts are kept locally and are not included in this PR.

Usage Notes

  • Access to the online services requires a Tianditu Key with the appropriate permissions.
  • resources/Workers/DC/decodeTdtTerrain.js must be deployed together with the SDK. When using a separate resource base URL, the worker path can be configured via workerUrl.
  • The existing imagery factory API and Promise return conventions are preserved.
  • 3D place names and 2D annotations can be configured independently to avoid duplicate label overlays.

@zishang520
zishang520 force-pushed the feat/tianditu-services branch 2 times, most recently from 541cc82 to 4009dce Compare October 8, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant