---
title: "MapboxTiandituLayer"
description: "以天地图 WMTS 瓦片作底图，支持矢量/影像/地形及对应注记叠加。"
seo_title: "MapboxTiandituLayer Component"
seo_description: "Render Tianditu WMTS basemaps (vector, imagery, terrain) with optional matching annotation overlays."
canonical_url: "https://mapbox.mhaibaraai.cn/docs/extensions/tianditu"
---
# MapboxTiandituLayer

> 以天地图 WMTS 瓦片作底图，支持矢量/影像/地形及对应注记叠加。

## 简介

`MapboxTiandituLayer` 以天地图 WMTS 瓦片作底图：`layer` 选类型（`vec` 矢量 / `img` 影像 / `ter` 地形，及注记 `cva`/`cia`/`cta`），`annotation` 叠加对应注记层，`tk` 缺省时回退运行时配置的 `tiandituToken`。

> \[\!NOTE\]
> 
> 天地图坐标系为 WGS84（CGCS2000），自有 WGS84 数据可直接叠加，无需 
> 
> 坐标转换
> 
> ；只有高德 / 腾讯（GCJ02）、百度（BD09）的数据叠加时才需要先转换。

## 用法

切换 `layer` 查看矢量/影像/地形底图（均叠加注记）：

```vue [TiandituLayerExample.vue]
<script setup lang="ts">
withDefaults(defineProps <{
  layer?: 'vec' | 'img' | 'ter'
  annotation?: boolean
}> (), {
  layer: 'vec',
  annotation: true
})
</script>

<template>
  <div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
    <MapboxMap :options="{ style: 'mapbox://styles/mapbox/empty-v9', center: [116.397, 39.908], zoom: 10 }">
      <MapboxTiandituLayer
        :layer="layer"
        :annotation="annotation"
      />
    </MapboxMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MapboxTiandituLayer component
 */
interface MapboxTiandituLayerProps {
  /**
   * 天地图图层类型（vec 矢量底图）
   * @default "\"vec\""
   */
  layer?: TiandituLayerType | undefined;
  /**
   * 天地图 token；缺省时回退运行时配置
   */
  tk?: string | undefined;
  /**
   * 叠加对应注记图层（vec→cva / img→cia / ter→cta）
   * @default "false"
   */
  annotation?: boolean | undefined;
  /**
   * 插入到该图层之前
   */
  beforeId?: string | undefined;
}
```

## Changelog

See commit history for [src/runtime/components/extensions/TiandituLayer.vue](https://github.com/mhaibaraai/movk-mapbox/commits/main/src/runtime/components/extensions/TiandituLayer.vue).


## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
