代码
import {
Engine,
FastTileLoaderStrategy,
MapView,
WMTSImageryTileProvider,
} from '@baidumap/mapv-three';
const engine = new Engine('map', {
map: {
projection: 'EPSG:3857',
center: [11.404, 47.269],
pitch: 0,
range: 290_000,
provider: null,
},
});
const provider = new WMTSImageryTileProvider({
url: 'https://tiles.maps.eox.at/wmts/1.0.0/{layer}/{style}/{tilematrixset}/{tilematrix}/{tilerow}/{tilecol}.jpg',
requestEncoding: 'REST',
maxLevel: 14,
params: {
LAYER: 's2cloudless-2020_3857',
STYLE: 'default',
TILEMATRIXSET: 'GoogleMapsCompatible',
},
});
const mapView = engine.add(
new MapView({
imageryProviders: [provider],
}),
);
mapView.rasterSurface.strategy = new FastTileLoaderStrategy();
使用 WMTSImageryTileProvider 以 REST 方式加载 EOX 提供的 Sentinel-2 影像。图层名、瓦片矩阵集和请求模板来自服务的 GetCapabilities,示例定位到奥地利阿尔卑斯山区。
预览