This repository has been archived on 2026-03-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
mars-titiler/README.md
2026-02-25 11:38:05 +08:00

96 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Mars Titiler Server
基于 Titiler 的火星瓦片服务,用于提供 Mars MGS MOLA Color-Shaded Relief 全球底图。
## 功能特点
- 使用 Titiler 框架,代码简洁高效
- 自定义火星坐标系SimpleCylindrical米制
- 支持 Cesium GeographicTilingScheme (2×1 瓦片布局)
- 自动提供多个端点tiles、tilejson、info、preview、statistics 等
## 快速启动
```bash
# 激活环境
source /home/la/miniconda3/bin/activate gdal_env
# 启动服务
uvicorn app:app --reload --host 0.0.0.0 --port 8000
```
## API 端点
所有端点都需要 `url` 参数指定数据文件路径。
### 核心端点
- **瓦片**: `/cog/tiles/MarsCylindrical/{z}/{x}/{y}?url=<path>`
- 格式PNG、WebP、JPEG 等(默认 PNG
- **TileJSON**: `/cog/MarsCylindrical/tilejson.json?url=<path>`
- 返回 TileJSON 2.2.0 元数据
- **数据信息**: `/cog/info?url=<path>`
- 返回栅格数据的详细信息波段、范围、CRS 等)
- **预览**: `/cog/preview.png?url=<path>&max_size=512`
- 返回全局预览图
### 示例
```bash
# 设置数据路径
DATA_PATH="/home/la/studio/cesium/rio-tiler-tms/data/Mars_MGS_MOLA_ClrShade_merge_global_463m.tif"
# 获取数据信息
curl "http://localhost:8000/cog/info?url=$DATA_PATH"
# 获取 TileJSON
curl "http://localhost:8000/cog/MarsCylindrical/tilejson.json?url=$DATA_PATH"
# 获取瓦片 (zoom=0, x=0, y=0)
curl "http://localhost:8000/cog/tiles/MarsCylindrical/0/0/0?url=$DATA_PATH" -o tile.png
# 获取预览图
curl "http://localhost:8000/cog/preview.png?url=$DATA_PATH&max_size=512" -o preview.png
```
## 与原版对比
### 原版 (rio-tiler-tms)
```
/tiles/{z}/{x}/{y}.png
/tilejson.json
```
- 数据路径硬编码
- 手动实现端点
### Titiler 版本
```
/cog/tiles/MarsCylindrical/{z}/{x}/{y}?url=<path>
/cog/MarsCylindrical/tilejson.json?url=<path>
/cog/info?url=<path>
/cog/preview.png?url=<path>
/cog/statistics?url=<path>
...更多端点
```
- 数据路径通过参数传递,更灵活
- 自动生成所有端点
- 代码量减少 70%
## 技术细节
### 火星坐标系
- **投影**: 等距柱状投影 (Equidistant Cylindrical)
- **球体半径**: 3,396,190 米
- **范围**:
- X: ±10,669,442 米 (±180°)
- Y: ±5,334,721 米 (±90°)
- **TMS**: matrix_scale=[2, 1]zoom 0 有 2×1 个瓦片
### 与 Cesium 集成
该 TMS 设计与 Cesium 的 GeographicTilingScheme 完全兼容,无需修改客户端代码。