This commit is contained in:
tianlong 2023-06-25 09:15:02 +08:00
parent bb24077192
commit c2610e4b5a
2 changed files with 70 additions and 22 deletions

View File

@ -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]]);
}
});
}

View File

@ -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();