代码
import {BaiduMapConfig, BaiduVectorTileProvider, Engine} from '@baidumap/mapv-three';
BaiduMapConfig.ak = '您的密钥';
const container = document.getElementById('map');
// 窄屏时拉远镜头,让中国东西两侧都进入视野。
const aspect = container.clientWidth / container.clientHeight;
new Engine(container, {
map: {
projection: 'EPSG:3857',
center: [104, 35],
pitch: 0,
range: 13_500_000 / Math.min(1.35, aspect),
provider: new BaiduVectorTileProvider(),
},
});
从中国上空俯视百度矢量底图,观察 Web 墨卡托投影下的地理形状。
预览