---
title: "MaplibreBufferEllipse"
description: "椭圆缓冲区，按米半轴与方位角生成填充与描边图层。"
canonical_url: "https://maplibre.mhaibaraai.cn/docs/layers/buffer-ellipse"
---
# MaplibreBufferEllipse

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

## 简介

`MaplibreBufferEllipse` 以中心、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">
    <MaplibreMap :options="{ style: 'https://tiles.openfreemap.org/styles/positron', center, zoom: 11 }">
      <!-- x/y 半轴单位米，angle 为长轴方位角 -->
      <MaplibreBufferEllipse
        :center="center"
        :x-semi-axis="3000"
        :y-semi-axis="1500"
        :angle="30"
        color="#f59e0b"
      />
    </MaplibreMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MaplibreBufferEllipse component
 */
interface MaplibreBufferEllipseProps {
  /**
   * 中心经纬度
   */
  center: [number, number];
  /**
   * x 半轴（米）
   */
  xSemiAxis: number;
  /**
   * y 半轴（米）
   */
  ySemiAxis: number;
  /**
   * 旋转角（度，正北顺时针）
   * @default 0
   */
  angle?: number | undefined;
  /**
   * 周长采样段数
   * @default 64
   */
  steps?: number | undefined;
  /**
   * 图层 id 前缀；省略时自动生成，变更需配合 `:key` 重建
   */
  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-maplibre/commits/main/src/runtime/components/buffers/BufferEllipse.vue).


## Sitemap

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