master
lion 5 months ago
parent 2d21658e40
commit 7bd53b71aa

@ -139,7 +139,7 @@ const MAPCONFIGS = {
Map_axisOrientation: 'neu', // 轴 Map_axisOrientation: 'neu', // 轴
Map_global: false, // 全球 Map_global: false, // 全球
MAP_center: [120.6126391, 31.3029816], // 定义中心点 MAP_center: [120.6126391, 31.3029816], // 定义中心点
// [113.85630301,22.63856214] // [120.6126391, 31.3029816] [113.85630301,22.63856214]
Map_Zooms: [12, 23, 10], // 定义地图初始层级、最大层级、最小层级 Map_Zooms: [12, 23, 10], // 定义地图初始层级、最大层级、最小层级
Map_ID: 'maps' // 地图标识ID Map_ID: 'maps' // 地图标识ID
} }

@ -121,7 +121,7 @@ export default {
this.map = map this.map = map
// //
let url = 'http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}' let url = 'http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}'
url = `${url}&T=vec_c&tk=2eecd3d615e01cf6dbe6d4b8b686d264` url = `${url}&T=vec_c&tk=75488413aef20f190e5c7708347c3e56`
const tdtLayer = new TileLayer({ const tdtLayer = new TileLayer({
title: '天地图', title: '天地图',
id: 'M2', id: 'M2',

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

@ -125,7 +125,7 @@ export default {
console.log('开始执行2') console.log('开始执行2')
const script = document.createElement('script') const script = document.createElement('script')
script.type = 'text/JavaScript' script.type = 'text/JavaScript'
script.src = 'http://api.tianditu.gov.cn/api?v=4.0&tk=2eecd3d615e01cf6dbe6d4b8b686d264' script.src = 'http://api.tianditu.gov.cn/api?v=4.0&tk=75488413aef20f190e5c7708347c3e56'
console.log('开始执行3') console.log('开始执行3')
script.onload = function() { script.onload = function() {
console.log('js加载完成') console.log('js加载完成')

@ -198,12 +198,17 @@ export default {
if (isSe) { if (isSe) {
this.list.push(data) this.list.push(data)
console.log('data', data) console.log('data', data)
this.locationObj = data this.locationObj = data
// this.locationObj.location.longitude="31.3029816"
// this.locationObj.location.latitude="120.6126391"
// [120.6126391, 31.3029816]
} else { } else {
for (var i = 0; i < this.list.length; i++) { for (var i = 0; i < this.list.length; i++) {
if (this.list[i].gps == data.gps) { if (this.list[i].gps == data.gps) {
this.list.splice(i, 1) this.list.splice(i, 1)
this.locationObj = data this.locationObj = data
// this.locationObj.location.longitude="31.3029816"
// this.locationObj.location.latitude="120.6126391"
} }
} }
// this.$refs.maps.removeLocation(data) // this.$refs.maps.removeLocation(data)

Loading…
Cancel
Save