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

const container = document.getElementById('map');
const center = [116.4223, 39.9189];
const range = (2540 * 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: 0,
    heading: 0,
    provider,
  },
  rendering: {
    sky: null,
  },
});

function point(coordinates, properties = {}) {
  return {
    type: 'Feature',
    geometry: {
      type: 'Point',
      coordinates,
    },
    properties,
  };
}

// size 为圆的直径,单位为米。
const stations = [
  point([116.422261, 39.914435, 4], {size: 500, color: '#2f7ad6'}),
  point([116.426774, 39.914399, 4], {size: 360, color: '#2f7ad6'}),
  point([116.417526, 39.922363, 4], {size: 800, color: '#e5533d'}),
  point([116.424268, 39.92337, 4], {size: 800, color: '#e5533d'}),
];
const source = GeoJSONDataSource.fromGeoJSON(stations);
source.defineAttribute('size').defineAttribute('color');

const circles = engine.add(
  new Circle({
    borderWidth: 6,
    borderColor: '#ffffff',
    transparent: true,
    fillOpacity: 0.45,
    vertexSizes: true,
    vertexColors: true,
  }),
);
circles.dataSource = source;

以东单至灯市口一带的四个站点为圆心绘制贴地圆,半径按站点服务范围设置,用描边强调边界。

预览