代码
import {
  BaiduMapConfig,
  BaiduVectorTileProvider,
  Engine,
  GeoJSONDataSource,
  Wall,
} from '@baidumap/mapv-three';

const container = document.getElementById('map');
const center = [116.50188, 39.99137];
const range = (760 * 1.42) / Math.min(1.42, container.clientWidth / container.clientHeight);
BaiduMapConfig.ak = '您的密钥';
const provider = new BaiduVectorTileProvider({
  displayOptions: {
    building: false,
    poi: false,
  },
});

const engine = new Engine(container, {
  map: {
    projection: 'EPSG:3857',
    center,
    range,
    pitch: 52,
    heading: 0,
    provider,
  },
  rendering: {
    sky: null,
    enableAnimationLoop: true,
  },
});

// 沿北京 798 艺术区西侧建筑区描绘的围栏,坐标系为 BD-09,首尾点相同以闭合。
const boundary = [
  [116.500852, 39.992321],
  [116.501944, 39.992344],
  [116.502875, 39.992367],
  [116.502885, 39.991716],
  [116.502905, 39.991251],
  [116.502915, 39.990422],
  [116.501975, 39.990414],
  [116.500902, 39.990399],
  [116.500872, 39.990817],
  [116.500852, 39.991391],
  [116.500852, 39.992321],
];
const source = GeoJSONDataSource.fromGeoJSON([
  {
    type: 'Feature',
    geometry: {
      type: 'LineString',
      coordinates: boundary,
    },
    properties: {},
  },
]);

const wall = engine.add(
  new Wall({
    height: 40,
    color: '#0dccff',
    transparent: true,
    enableAnimation: true,
    minOpacity: 0.1,
    maxOpacity: 0.8,
    animationTailType: 3,
    animationSpeed: 1,
    animationIdle: 100,
  }),
);
wall.dataSource = source;

沿北京 798 艺术区西侧建筑区的道路内侧拉起电子围栏,用 Wall 的垂直流光动画表示管控范围。

预览