MapboxBufferLine

View source
线缓冲区,沿线两侧扩展指定米宽生成走廊面。

简介

MapboxBufferLine 沿线两侧扩展 width 米生成走廊面,line 接受线要素、几何或坐标数组。常用于道路红线、管线保护范围等。

用法

沿折线生成 600m 宽走廊:

<script setup lang="ts">
const line: [number, number][] = [
  [116.34, 39.88],
  [116.4, 39.92],
  [116.46, 39.9],
  [116.5, 39.94]
]
</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: [116.42, 39.91], zoom: 11 }"
    >
      <!-- 沿线两侧扩展 width 米的走廊面 -->
      <MapboxBufferLine :line="line" :width="600" color="#10b981" />
    </MapboxMap>
  </div>
</template>

API

Props

Prop Default Type
lineGeoJSON.LineString | GeoJSON.Feature<GeoJSON.LineString, { [name: string]: any; }> | [number, number][]

线要素、几何或坐标数组

widthnumber

缓冲宽度(米)

layerIdstring

图层 id 前缀;省略时自动生成

colorstring

主色(快捷样式)

fillPaintRecord<string, unknown>

整体覆盖填充 paint

linePaintRecord<string, unknown>

整体覆盖描边 paint

beforeIdstring

插入到该图层之前

Changelog

No recent changes
Copyright © 2026 - 2026 YiXuan - MIT License