本地加载瓦片地图
//加載瓦片
// let extents = [105.4,36.82046936035156,105.9,37.78046936035156];
vm.map = new Map({target: document.getElementById("mapDiv"),controls: defaults({zoom: false,}),view: new View({// center: fromLonLat([105.68367004394531, 37.34046936035156]),zoom: 10,// extent: transformExtent(extents, 'EPSG:4326', 'EPSG:3857'),maxZoom: 18,minZoom: 10,}),
});
let imgMap = new Tile({source:new TileImage({projection: 'EPSG:4326',tileUrlFunction: function (tileCoord, pixelRatio, proj) {let z = tileCoord[0];let x = tileCoord[1];let y = tileCoord[2];// 百度瓦片服務url將負數使用M前綴來標識if (x < 0) {x = -x;}if (y < 0) {y = -y;}try {return require(`../../../../assets/images/map/img_c/${z}-${y - 1}-${x}.jpg`)}catch (e) {return require(`../../../../assets/images/map/img_c/10-147-808.jpg`)}}})
});
總結
- 上一篇: 智慧城市可视化管理系统
- 下一篇: 为什么使用微服务?要不要使用微服务?