MapboxBufferLine
线缓冲区,沿线两侧扩展指定米宽生成走廊面。
简介
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 |
|---|---|---|
line | GeoJSON.LineString | GeoJSON.Feature<GeoJSON.LineString, { [name: string]: any; }> | [number, number][]线要素、几何或坐标数组 | |
width | number缓冲宽度(米) | |
layerId | string图层 id 前缀;省略时自动生成 | |
color | string主色(快捷样式) | |
fillPaint | Record<string, unknown>整体覆盖填充 paint | |
linePaint | Record<string, unknown>整体覆盖描边 paint | |
beforeId | string插入到该图层之前 |
Changelog
No recent changes