---
title: "MaplibreGlobeControl"
description: "Projection control that toggles the map between a 3D globe and flat mercator on click."
canonical_url: "https://maplibre.mhaibaraai.cn/en/docs/controls/globe"
---
# MaplibreGlobeControl

> Projection control that toggles the map between a 3D globe and flat mercator on click.

## Introduction

`MaplibreGlobeControl` provides a button that toggles the projection between `globe` and `mercator`; `position` sets the dock corner.

> [!NOTE]
> 
> The control only recognizes string projections: an interpolation expression is treated as "not mercator" and switched back to mercator, so avoid combining them. When used with 
> 
> MaplibreProjection
> 
> , the toggled result is overridden by the component value after a style reload or props change.

## Usage

Click the button in the top-right corner to toggle between globe and flat views:

```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.
