|
|
|
|
@ -365,17 +365,18 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
this.map = map
|
|
|
|
|
// 添加天地图
|
|
|
|
|
let url = 'http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}'
|
|
|
|
|
url = `${url}&T=vec_c&tk=2eecd3d615e01cf6dbe6d4b8b686d264`
|
|
|
|
|
let url = 'http://t1.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}'
|
|
|
|
|
url = `${url}&T=vec_c&tk=75488413aef20f190e5c7708347c3e56`
|
|
|
|
|
// let sourceMark = `http://t0.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=5a257cd2df1b3311723bd77b0de14baf`
|
|
|
|
|
const sourceMark = 'http://t3.tianditu.com/DataServer?T=cva_c&x={x}&y={y}&l={z}&tk=2eecd3d615e01cf6dbe6d4b8b686d264'
|
|
|
|
|
const sourceMark = 'http://t3.tianditu.com/DataServer?T=cva_c&x={x}&y={y}&l={z}&tk=75488413aef20f190e5c7708347c3e56'
|
|
|
|
|
const tdtLayer = new TileLayer({
|
|
|
|
|
title: '天地图',
|
|
|
|
|
id: 'M2',
|
|
|
|
|
type: 'overlay',
|
|
|
|
|
visible: true,
|
|
|
|
|
layerType: 'TD地图',
|
|
|
|
|
opacity: 1,
|
|
|
|
|
opacity: 1,
|
|
|
|
|
preload: Infinity,
|
|
|
|
|
source: new XYZ({
|
|
|
|
|
crossOrigin: 'anonymous',
|
|
|
|
|
url: url,
|
|
|
|
|
@ -393,6 +394,7 @@ export default {
|
|
|
|
|
layerType: 'TD地图1',
|
|
|
|
|
opacity: 1,
|
|
|
|
|
zIndex: 2,
|
|
|
|
|
preload: Infinity,
|
|
|
|
|
source: new XYZ({
|
|
|
|
|
crossOrigin: 'anonymous',
|
|
|
|
|
url: sourceMark,
|
|
|
|
|
@ -439,7 +441,8 @@ export default {
|
|
|
|
|
tileGrid: tileGrid,
|
|
|
|
|
url: result.url,
|
|
|
|
|
projection: projection
|
|
|
|
|
})
|
|
|
|
|
}),
|
|
|
|
|
preload: Infinity,
|
|
|
|
|
})
|
|
|
|
|
this.map.addLayer(layer)
|
|
|
|
|
} else {
|
|
|
|
|
@ -449,7 +452,8 @@ export default {
|
|
|
|
|
type: result.type,
|
|
|
|
|
visible: result.visible,
|
|
|
|
|
layerType: result.layerType,
|
|
|
|
|
opacity: result.opacity,
|
|
|
|
|
opacity: result.opacity,
|
|
|
|
|
preload: Infinity,
|
|
|
|
|
source: new TileArcGISRest({
|
|
|
|
|
url: result.url,
|
|
|
|
|
projection: result.projection
|
|
|
|
|
@ -531,7 +535,9 @@ export default {
|
|
|
|
|
this.flagLayer.getSource().addFeatures(this.featuresArr)
|
|
|
|
|
this.$nextTick(function() {
|
|
|
|
|
// 根据定位点 移动地图
|
|
|
|
|
this.moveto(this.locationObj.location.longitude, this.locationObj.location.latitude)
|
|
|
|
|
// this.moveto(this.locationObj.location.longitude, this.locationObj.location.latitude)
|
|
|
|
|
this.moveto(this.locationObj.location.longitude, this.locationObj.location.latitude)
|
|
|
|
|
|
|
|
|
|
this.autoOpen(feature)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
@ -719,7 +725,8 @@ export default {
|
|
|
|
|
this.popup.setPosition(coordinates)
|
|
|
|
|
},
|
|
|
|
|
// 移动地图
|
|
|
|
|
moveto(longitude, latitude) {
|
|
|
|
|
moveto(longitude, latitude) {
|
|
|
|
|
console.log(longitude, latitude)
|
|
|
|
|
this.map.getView().animate({
|
|
|
|
|
center: [longitude, latitude], // 中心点
|
|
|
|
|
rotation: undefined,
|
|
|
|
|
|