Skip to content

Buffer 缓冲区分析

简介

  缓冲区分析用于在指定目标(如点、线、面)周围,生成一定距离范围内的区域,用于表示影响范围或服务覆盖范围。在 Cesium 中,该功能常用于划定安全警戒区、分析设施周边影响范围,如地铁站500米生活圈、河流污染带等,为城市规划、应急响应、环境保护等提供空间决策支持。


演练场

引入

ts
import { Buffer } from "@m-tech/gis-core";

new Buffer(viewer, options);

参数

参数类型必填默认值描述
viewerViewer-容器
optionsObject{}缓冲区分析配置
options.typeBufferTypeBufferType.POLYGON缓冲区类型
options.positionsPosition[]Position[]目标位置
options.distancenumber10缓冲区距离
options.colorColorColor.RED缓冲区颜色

属性

属性名类型读/写描述
bufferedPosition[]缓冲区结果
delegateEntity缓冲区实体
distancenumber读写缓冲区距离
typeBufferType缓冲区类型

方法

清除缓冲区。

示例

ts
import { Buffer, BufferType } from "@m-tech/gis-core";

// 点缓冲区
const bufferPoint = new Buffer(viewer, {
  type: BufferType.POINT,
  positions: [new Position(114.31, 30.57)],
  distance: 100,
  color: Color.BLUE.withAlpha(0.5),
});

// 线缓冲区
const bufferPolyline = new Buffer(viewer, {
  type: BufferType.POLYLINE,
  positions: [new Position(114.31, 30.57), new Position(114.32, 30.58)],
  distance: 100,
  color: Color.GREEN.withAlpha(0.5),
});

// 面缓冲区
const bufferPolygon = new Buffer(viewer, {
  type: BufferType.POLYGON,
  positions: [
    new Position(114.31, 30.57),
    new Position(114.32, 30.58),
    new Position(114.33, 30.59),
  ],
  distance: 100,
  color: Color.RED.withAlpha(0.5),
});

// 清除缓冲区
bufferPoint.clear();
bufferPolyline.clear();
bufferPolygon.clear();

MGis 地理三维库