---
title: "MapboxBufferCircle"
description: "Circular buffer that generates a geodesic circle from a center point and meter radius, rendered as fill and line layers."
canonical_url: "https://mapbox.mhaibaraai.cn/en/docs/layers/buffer-circle"
---
# MapboxBufferCircle

> Circular buffer that generates a geodesic circle from a center point and meter radius, rendered as fill and line layers.

## Introduction

`MapboxBufferCircle` generates a Turf.js geodesic circle from a center point and meter radius, rendered as fill and stroke layers. `color` provides a quick color shortcut; `fillPaint` / `linePaint` allow full style overrides.

## Usage

Drag the slider to adjust the radius (in meters):

```vue [BufferCircleExample.vue]
<script setup lang="ts">
const center: [number, number] = [116.397, 39.908]
const radius = ref(2000)
</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 }">
      <div class="absolute left-3 top-3 z-10 flex items-center gap-2 rounded-(--ui-radius) border border-default bg-default/80 px-3 py-1.5 backdrop-blur">
        <span class="text-sm text-muted">半径 {{ radius }}m</span>
        <USlider v-model="radius" :min="500" :max="5000" :step="500" class="w-32" />
      </div>
      <!-- turf 测地圆，半径单位米 -->
      <MapboxBufferCircle :center="center" :radius="radius" color="#3b82f6" />
    </MapboxMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MapboxBufferCircle component
 */
interface MapboxBufferCircleProps {
  /**
   * 圆心经纬度
   */
  center: [number, number];
  /**
   * 半径（米）
   */
  radius: 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/BufferCircle.vue](https://github.com/mhaibaraai/movk-mapbox/commits/main/src/runtime/components/buffers/BufferCircle.vue).


## Sitemap

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