feat: support custom provider#128
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a configurable “custom provider” mechanism for imagery + tilesets across the Visualizer → Map → Cesium engine pipeline, refactors Cesium imagery/terrain handling, and updates the example app to exercise the new configuration.
Changes:
- Introduces
CustomProviderConfig(imagery + layer provider entries) and threads it through core props/context. - Reworks Cesium imagery layer creation to avoid Resium StrictMode async cleanup issues and to maintain ordering with async provider resolution.
- Expands tileset/terrain/tile preset support (Re:Earth terrain/buildings, Google Photorealistic provider selection, Cesium Ion preset types + per-tile asset IDs) and updates the example app/env accordingly.
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| vite.config.example.ts | Sets example dev server port and adds terrain proxy for local CORS avoidance. |
| src/Visualizer/index.tsx | Adds customProvider prop and passes it into the Map. |
| src/Map/types/viewerProperty.ts | Updates terrain type union and adds cesiumIonAssetId to tile properties. |
| src/Map/types/index.ts | Exports CustomProviderConfig and adds it to EngineProps. |
| src/Map/types/customProvider.ts | Adds new provider config types for imagery/layers. |
| src/Map/Sketch/sketchMachine.ts | Formatting-only refactor of sketch state machine definition. |
| src/mantle/types/index.ts | Adds provider field to layer data and new reearth-buildings data type. |
| src/engines/Cesium/index.tsx | Threads customProvider into Cesium context and expands delegated data types. |
| src/engines/Cesium/hooks/useOverrideGlobeShader/useOverrideGlobeShader.ts | Comment formatting adjustment. |
| src/engines/Cesium/hooks.ts | Stops defaulting to Ion.defaultAccessToken and passes customProvider through context. |
| src/engines/Cesium/Feature/Tileset/hooks.ts | Adds provider selection and new tileset URL resolution logic (Re:Earth/Google/Ion/buildings). |
| src/engines/Cesium/Feature/index.tsx | Enables rendering for reearth-buildings. |
| src/engines/Cesium/Feature/context.ts | Adds customProvider into Cesium feature context. |
| src/engines/Cesium/core/presets.ts | Adds Cesium Ion presets and per-tile Ion asset support; keeps legacy aliases. |
| src/engines/Cesium/core/Imagery.tsx | Replaces Resium <ImageryLayer /> usage with manual collection management + async reorder; adds custom provider imagery resolution. |
| src/engines/Cesium/core/Imagery.test.ts | Updates tests for new provider shape and custom provider behavior. |
| src/engines/Cesium/core/Globe/useTerrainProviderPromise.ts | Refactors terrain provider selection and defaults (Re:Earth terrain); improves cache keying. |
| src/engines/Cesium/core/Globe/index.tsx | Minor cleanup of terrain load error handling. |
| src/engines/Cesium/core/customProviderResolver.ts | Adds resolver helpers for provider config (currently unused). |
| example/testLayers/reearth_buildings.ts | Adds a Re:Earth buildings demo layer. |
| example/testLayers/index.ts | Registers the new Re:Earth buildings test layer. |
| example/scene.ts | Sets Re:Earth terrain as the default in the example scene. |
| example/hooks.ts | Adds EXAMPLE_CUSTOM_PROVIDER parsing + UI state for Ion asset ID selection. |
| example/constants.ts | Updates tile preset list and comments for new imagery options. |
| example/components/OptionsPanel/index.tsx | Adds UI for selecting custom tiles and entering Ion asset IDs. |
| example/App.tsx | Passes customProvider and related UI props through to the Visualizer. |
| .env.example | Documents new env vars and how to configure custom providers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR adds support for custom tile providers and fixes critical async loading issues with imagery layers.
🎯 Key Changes
New Types:
Files added:
Files changed: src/engines/Cesium/core/Imagery.tsx
Files changed: src/engines/Cesium/core/presets.ts
Files changed: src/engines/Cesium/Feature/Tileset/hooks.ts
Files changed:
Files changed: src/engines/Cesium/core/Globe/useTerrainProviderPromise.ts
📊 Statistics
🔍 Testing
🔗 Related Issues
Fixes imagery layer ordering crashes when using async tile providers.