diff --git a/src/views/crops/classify/Classify.vue b/src/views/crops/classify/Classify.vue index 1ce3656..461c737 100644 --- a/src/views/crops/classify/Classify.vue +++ b/src/views/crops/classify/Classify.vue @@ -1072,7 +1072,8 @@ function initonMounted() { getcropTypeStatisticss('370211'); //作物类型统计百分比 getaArea(); //面积 getTownships('370211'); - initMap(); //地图 + // initMap(); //地图 + initmap(); areachar(); //图表 typesof(); //图表 farmland(); //图表 @@ -1203,7 +1204,38 @@ function initMap() { addWheelEvent(); //鼠标滚动控制村级矢量显示隐藏 // addEvent(); //点击事件 - clickSearch() + clickSearch(); +} + +function initmap() { + var map = new ol.Map({ + target: 'cesiumContainer', + layers: [ + //加载瓦片图层数据 + new ol.layer.Tile({ + title: '天地图矢量图层', + source: new ol.source.XYZ({ + url: 'http://t0.tianditu.com/DataServer?T=vec_w&tk=5956e6519f2bb0ae8e57bc834298c9f1&x={x}&y={y}&l={z}', + wrapX: false, + }), + }), + new ol.layer.Tile({ + title: '天地图矢量图层注记', + source: new ol.source.XYZ({ + url: 'http://t0.tianditu.com/DataServer?T=cia_w&tk=5956e6519f2bb0ae8e57bc834298c9f1&x={x}&y={y}&l={z}', + wrapX: false, + }), + }), + ], + controls: ol.control + .defaults({ attributionOptions: { collapsed: false } }) + .extend([new ol.supermap.control.Logo()]), + view: new ol.View({ + center: ['116', '39'], + zoom: 2, + projection: 'EPSG:3857', + }), + }); } //鼠标滑轮事件 @@ -1233,10 +1265,7 @@ const clickSearch = () => { gaoliangline = null; } var pickRay = viewer.camera.getPickRay(event.position); - var featuresPromise = viewer.imageryLayers.pickImageryLayerFeatures( - pickRay, - viewer.scene - ); + var featuresPromise = viewer.imageryLayers.pickImageryLayerFeatures(pickRay, viewer.scene); if (!Cesium.defined(featuresPromise)) { console.log('No features picked.'); } else { @@ -1468,12 +1497,12 @@ watch( }); newData.forEach(item => { if (layersDic[item]) { - addWms(layersDic[item], layersDic[item]); + // addWms(layersDic[item], layersDic[item]); } }); // 添加镇级矢量 - cun(); //添加村 - zhen(); //添加镇 + // cun(); //添加村 + // zhen(); //添加镇 } else if (val.length < oldVal.length) { // 挑选出减少的数据 const newData = oldVal.filter(item => { @@ -1484,7 +1513,7 @@ watch( }); newData.forEach(item => { if (layersDic[item]) { - removeWms([layersDic[item]]); + // removeWms([layersDic[item]]); } }); } diff --git a/src/views/crops/output/maize/index.vue b/src/views/crops/output/maize/index.vue index ff598ea..8c26cc2 100644 --- a/src/views/crops/output/maize/index.vue +++ b/src/views/crops/output/maize/index.vue @@ -238,7 +238,6 @@ let rightWraFlag = ref(true); let standardArr = ref([]); let estimate = ref({}); let administration = ref([]); -let url = 'https://iserver.supermap.io/iserver/services/map-world/rest/maps/World'; let map = ref(null); //行政区划数据 var data = { @@ -258,28 +257,48 @@ let dd = { }; let areatext = '8383894'; const add = () => { - var url = 'https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China'; + // var url= 'http://t0.tianditu.com/DataServer?T=vec_w&tk=5956e6519f2bb0ae8e57bc834298c9f1&x={x}&y={y}&l={z}'; + // 初始化地图信息 var map = new ol.Map({ target: 'cesiumContainer', + layers: [ + //加载瓦片图层数据 + new ol.layer.Tile({ + title: '天地图矢量图层', + source: new ol.source.XYZ({ + url: 'http://t0.tianditu.com/DataServer?T=vec_w&tk=5956e6519f2bb0ae8e57bc834298c9f1&x={x}&y={y}&l={z}', + wrapX: false, + }), + }), + new ol.layer.Tile({ + title: '天地图矢量图层注记', + source: new ol.source.XYZ({ + url: 'http://t0.tianditu.com/DataServer?T=cia_w&tk=5956e6519f2bb0ae8e57bc834298c9f1&x={x}&y={y}&l={z}', + wrapX: false, + }), + }), + ], controls: ol.control .defaults({ attributionOptions: { collapsed: false } }) .extend([new ol.supermap.control.Logo()]), view: new ol.View({ - center: [0, 0], + center: [116, 39], zoom: 2, projection: 'EPSG:3857', }), }); + // map.getView().fit([119.5091, 35.5671, 120.3285, 36.1455]); + // 添加图层 - var layer = new ol.layer.Tile({ - source: new ol.source.TileSuperMapRest({ - url: url, - wrapX: true, - }), - projection: 'EPSG:3857', - }); - map.addLayer(layer); + // var layer = new ol.layer.Tile({ + // source: new ol.source.TileSuperMapRest({ + // url: url, + // wrapX: true, + // }), + // projection: 'EPSG:4326', // 坐标系 + // }); + // map.addLayer(layer); }; // 组件挂载完成后执行 @@ -289,7 +308,7 @@ onMounted(() => { getcornGetAllTownss(); //镇级 //地图 // initMap(); - add() + add(); farmland(); // ProgressBar(); ASdivision();