Skip to content

BufferCircleLayer

Supports drag-and-drop to change position, drag-and-drop to resize, real-time radius display, and other features.

TIP

  • The MbBufferCircleLayerV2 component uses a planar pixel algorithm to draw circles, which solves the circle distortion problem in coordinate systems such as 4490 and 4326.
  • The MbBufferCircleLayer component uses turf.circle to draw circles. It can still be used in the 3857 coordinate system.

Example

Example Source Code
vue
<template>
  <div style="height: 400px" class="vw-full vh-full">
    <mb-map
      :zoom="10"
      :center="center"
      :glyphs="__RESOURCE_URL__ + 'fonts/{fontstack}/{range}.pbf'"
    >
      <mb-tianditu-layer />
      <mb-buffer-circle-layer
        :center="center"
        :radius="radius"
        border-color="red"
        :border-opacity="0.5"
        background-color="red"
        center-color="red"
        resizer-color="blue"
        :background-opacity="0.1"
        text-color="blue"
        :closable="true"
        :countable="true"
        :draggable="true"
        :resizable="true"
      />
    </mb-map>
  </div>
</template>
<script setup lang="ts">
const center = [116.17381, 39.92155464]
const radius = 10
</script>

EPSG:4490(CGCS2000)

Example Source Code
vue
<template>
  <div style="height: 400px" class="vw-full vh-full">
    <mb-map
      crs="EPSG:4490"
      :zoom="10"
      :center="center"
      :glyphs="__RESOURCE_URL__ + 'fonts/{fontstack}/{range}.pbf'"
    >
      <mb-tianditu-layer />
      <mb-buffer-circle-layer
        :center="center"
        :radius="radius"
        border-color="red"
        :border-opacity="0.5"
        background-color="red"
        center-color="red"
        resizer-color="blue"
        :background-opacity="0.1"
        text-color="blue"
        :closable="true"
        :countable="true"
        :draggable="true"
        :resizable="true"
      />
      <mb-buffer-circle-layer-v2
        :center="center"
        :radius="radius"
        border-color="red"
        :border-opacity="0.5"
        background-color="red"
        center-color="red"
        resizer-color="blue"
        :background-opacity="0.1"
        text-color="blue"
        :closable="true"
        :countable="true"
        :draggable="true"
        :resizable="true"
      />
    </mb-map>
  </div>
</template>
<script setup lang="ts">
const center = [116.17381, 39.92155464]
const radius = 10
</script>

API

PROPS

NameDescriptionTypeDefault
idLayer IDstring-
centerBuffer center pointnumber[]-
radiusBuffer radius, in kilometersnumber10
border-colorBorder colorstringblue
border-opacityBorder opacitynumber0.5
border-widthBorder widthnumber5
background-colorBackground colorstringblue
background-opacityBackground opacitynumber0.1
resizer-colorResizer icon colorstringblack
center-colorCenter point icon colorstringred
closableWhether to display the close iconbooleanfalse
countableWhether to display the radius value as text. You need to load Mapbox font filesbooleanfalse
resizableWhether to display the resizer iconbooleanfalse
draggableWhether the buffer is draggablebooleanfalse
visibleWhether to display the bufferbooleantrue
resizer-radiusResizer icon circle radiusnumber8
center-radiusCenter point icon circle radiusnumber8
text-fontsFont settings for countable textstring[]['Open Sans Regular']
text-colorColor of the countable text.string#000000
text-sizeSize of the countable textnumber16
formatterFormatter for the countable textfunction(radius) => string
close-sizeScaling factor for the close iconnumber0.7
close-offsetOffset of the close iconnumber[][70, 0]
close-icon-urlURL of a custom close iconstring-

EVENTS

NameDescriptionParameters
updateTriggered when the buffer is changedParameters:{center,radius}
closeTriggered when the close operation is clickedMapMouseEvent
mouseenterTriggered when the mouse enters the buffer-
mouseleaveTriggered when the mouse leaves the buffer-

SLOTS

NameDescription

METHODS

NameDescriptionDefinition