代码
import {
  Engine,
  FastTileLoaderStrategy,
  MapView,
  WMSImageryTileProvider,
} from '@baidumap/mapv-three';

const engine = new Engine('map', {
  map: {
    projection: 'EPSG:3857',
    center: [13.397, 52.518],
    pitch: 0,
    range: 18_000,
    provider: null,
  },
});

const provider = new WMSImageryTileProvider({
  url: 'https://ows.terrestris.de/osm/service',
  maxLevel: 18,
  params: {
    VERSION: '1.1.1',
    SRS: 'EPSG:3857',
    LAYERS: 'OSM-WMS',
    FORMAT: 'image/png',
    TRANSPARENT: false,
  },
});

const mapView = engine.add(
  new MapView({
    imageryProviders: [provider],
  }),
);
mapView.rasterSurface.strategy = new FastTileLoaderStrategy();

使用 WMSImageryTileProvider 向 terrestris WMS 发送 GetMap 请求。服务根据 WMS 1.1.1、EPSG:3857 和 SDK 为每块瓦片计算的 BBOX 返回地图图片。

预览