---
title: "MapboxTiandituLayer"
description: "Render Tianditu WMTS basemaps (vector, imagery, terrain) with optional matching annotation overlays."
canonical_url: "https://mapbox.mhaibaraai.cn/en/docs/extensions/tianditu"
---
# MapboxTiandituLayer

> Render Tianditu WMTS basemaps (vector, imagery, terrain) with optional matching annotation overlays.

## Introduction

`MapboxTiandituLayer` renders Tianditu WMTS tiles as a basemap: `layer` selects the type (`vec` vector / `img` imagery / `ter` terrain, plus annotation variants `cva`/`cia`/`cta`), `annotation` overlays the matching annotation layer, and `tk` falls back to the runtime-configured `tiandituToken` when omitted.

> [!NOTE]
> 
> Tianditu uses the WGS84 (CGCS2000) datum — your own WGS84 data overlays directly with no conversion needed. Only Amap / Tencent (GCJ02) or Baidu (BD09) data needs 
> 
> Coordinate Conversion
> 
>  first.

## Usage

Toggle `layer` to preview vector, imagery, and terrain basemaps (all with annotation overlay):

```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](https://mapbox.mhaibaraai.cn/sitemap.md) for all pages.
