---
title: "MapboxBufferSector"
description: "扇形缓冲区，按起止方位角与米半径生成扇面。"
seo_title: "MapboxBufferSector Component"
seo_description: "MapboxBufferSector renders a sector wedge from a center, meter radius and start/end bearings as fill and line layers via Turf.js."
canonical_url: "https://mapbox.mhaibaraai.cn/docs/layers/buffer-sector"
---
# MapboxBufferSector

> 扇形缓冲区，按起止方位角与米半径生成扇面。

## 简介

`MapboxBufferSector` 以圆心、米半径与起止方位角（`bearing1` → `bearing2`，正北顺时针）生成扇面，渲染为填充 + 描边两层。常用于视域、信号覆盖扇区等。

## 用法

30° → 120° 的扇形，半径 3000m：

```vue [BufferSectorExample.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 }">
      <!-- bearing1 → bearing2（度，正北顺时针）扇面，半径单位米 -->
      <MapboxBufferSector
        :center="center"
        :radius="3000"
        :bearing1="30"
        :bearing2="120"
        color="#f43f5e"
      />
    </MapboxMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MapboxBufferSector component
 */
interface MapboxBufferSectorProps {
  /**
   * 圆心经纬度
   */
  center: [number, number];
  /**
   * 半径（米）
   */
  radius: number;
  /**
   * 起始方位角（度）
   */
  bearing1: number;
  /**
   * 结束方位角（度）
   */
  bearing2: number;
  /**
   * 弧线采样段数
   * @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/BufferSector.vue](https://github.com/mhaibaraai/movk-mapbox/commits/main/src/runtime/components/buffers/BufferSector.vue).


## Sitemap

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