---
title: "MapboxBufferEllipse"
description: "椭圆缓冲区，按米半轴与方位角生成填充与描边图层。"
seo_title: "MapboxBufferEllipse Component"
seo_description: "MapboxBufferEllipse renders an ellipse buffer from a center, meter semi-axes and orientation angle as fill and line layers, powered by Turf.js."
canonical_url: "https://mapbox.mhaibaraai.cn/docs/layers/buffer-ellipse"
---
# MapboxBufferEllipse

> 椭圆缓冲区，按米半轴与方位角生成填充与描边图层。

## 简介

`MapboxBufferEllipse` 以中心、x/y 半轴（米）与长轴方位角 `angle` 生成椭圆，渲染为填充 + 描边两层。

## 用法

长轴 3000m、短轴 1500m、旋转 30°：

```vue [BufferEllipseExample.vue]
<script setup lang="ts">
const center: [number, number] = [116.397, 39.908]
</script>

<template>
  <div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
    <MapboxMap :options="{ style: 'mapbox://styles/mapbox/light-v11', center, zoom: 11 }">
      <!-- x/y 半轴单位米，angle 为长轴方位角 -->
      <MapboxBufferEllipse
        :center="center"
        :x-semi-axis="3000"
        :y-semi-axis="1500"
        :angle="30"
        color="#f59e0b"
      />
    </MapboxMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MapboxBufferEllipse component
 */
interface MapboxBufferEllipseProps {
  /**
   * 中心经纬度
   */
  center: [number, number];
  /**
   * x 半轴（米）
   */
  xSemiAxis: number;
  /**
   * y 半轴（米）
   */
  ySemiAxis: number;
  /**
   * 旋转角（度，正北顺时针）
   * @default "0"
   */
  angle?: number | undefined;
  /**
   * 周长采样段数
   * @default "64"
   */
  steps?: number | undefined;
  /**
   * 图层 id 前缀；省略时自动生成
   */
  layerId?: string | undefined;
  /**
   * 主色（快捷样式）
   */
  color?: string | undefined;
  /**
   * 整体覆盖填充 paint
   */
  fillPaint?: Record<string, unknown> | undefined;
  /**
   * 整体覆盖描边 paint
   */
  linePaint?: Record<string, unknown> | undefined;
  /**
   * 插入到该图层之前
   */
  beforeId?: string | undefined;
}
```

## Changelog

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


## Sitemap

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