---
title: "MaplibreGlobeControl"
description: "投影切换控件，点击在球形地球（globe）与平面墨卡托间切换。"
canonical_url: "https://maplibre.mhaibaraai.cn/docs/controls/globe"
---
# MaplibreGlobeControl

> 投影切换控件，点击在球形地球（globe）与平面墨卡托间切换。

## 简介

`MaplibreGlobeControl` 提供投影切换按钮，点击在 `globe` 与 `mercator` 间切换；`position` 指定停靠角。

> [!NOTE]
> 
> 控件只识别字符串投影：当前投影为插值表达式时会被视为「非 mercator」并切回 mercator，此场景不建议搭配使用。与 
> 
> MaplibreProjection
> 
>  并用时，控件切换结果会在样式重载或组件 props 变化后被组件值覆盖。

## 用法

点击右上角按钮切换球体与平面：

```vue [GlobeControlExample.vue]
<template>
  <div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
    <MaplibreMap :options="{ style: 'https://tiles.openfreemap.org/styles/liberty', center: [105, 30], zoom: 1.5 }">
      <MaplibreGlobeControl position="top-right" />
    </MaplibreMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MaplibreGlobeControl component
 */
interface MaplibreGlobeControlProps {
  /**
   * 控件停靠位置；省略用地图默认位置
   */
  position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | undefined;
}
```

## Changelog

See commit history for [src/runtime/components/controls/GlobeControl.vue](https://github.com/mhaibaraai/movk-maplibre/commits/main/src/runtime/components/controls/GlobeControl.vue).


## Sitemap

See the full [sitemap](https://maplibre.mhaibaraai.cn/sitemap.md) for all pages.
