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'); // getcropTypeStatisticss('370211'); //
getaArea(); // getaArea(); //
getTownships('370211'); getTownships('370211');
initMap(); // // initMap(); //
initmap();
areachar(); // areachar(); //
typesof(); // typesof(); //
farmland(); // farmland(); //
@ -1203,7 +1204,38 @@ function initMap() {
addWheelEvent(); // addWheelEvent(); //
// addEvent(); // // 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; gaoliangline = null;
} }
var pickRay = viewer.camera.getPickRay(event.position); var pickRay = viewer.camera.getPickRay(event.position);
var featuresPromise = viewer.imageryLayers.pickImageryLayerFeatures( var featuresPromise = viewer.imageryLayers.pickImageryLayerFeatures(pickRay, viewer.scene);
pickRay,
viewer.scene
);
if (!Cesium.defined(featuresPromise)) { if (!Cesium.defined(featuresPromise)) {
console.log('No features picked.'); console.log('No features picked.');
} else { } else {
@ -1468,12 +1497,12 @@ watch(
}); });
newData.forEach(item => { newData.forEach(item => {
if (layersDic[item]) { if (layersDic[item]) {
addWms(layersDic[item], layersDic[item]); // addWms(layersDic[item], layersDic[item]);
} }
}); });
// //
cun(); // // cun(); //
zhen(); // // zhen(); //
} else if (val.length < oldVal.length) { } else if (val.length < oldVal.length) {
// //
const newData = oldVal.filter(item => { const newData = oldVal.filter(item => {
@ -1484,7 +1513,7 @@ watch(
}); });
newData.forEach(item => { newData.forEach(item => {
if (layersDic[item]) { if (layersDic[item]) {
removeWms([layersDic[item]]); // removeWms([layersDic[item]]);
} }
}); });
} }

View File

@ -238,7 +238,6 @@ let rightWraFlag = ref(true);
let standardArr = ref([]); let standardArr = ref([]);
let estimate = ref({}); let estimate = ref({});
let administration = ref([]); let administration = ref([]);
let url = 'https://iserver.supermap.io/iserver/services/map-world/rest/maps/World';
let map = ref(null); let map = ref(null);
// //
var data = { var data = {
@ -258,28 +257,48 @@ let dd = {
}; };
let areatext = '8383894'; let areatext = '8383894';
const add = () => { 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({ var map = new ol.Map({
target: 'cesiumContainer', 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 controls: ol.control
.defaults({ attributionOptions: { collapsed: false } }) .defaults({ attributionOptions: { collapsed: false } })
.extend([new ol.supermap.control.Logo()]), .extend([new ol.supermap.control.Logo()]),
view: new ol.View({ view: new ol.View({
center: [0, 0], center: [116, 39],
zoom: 2, zoom: 2,
projection: 'EPSG:3857', projection: 'EPSG:3857',
}), }),
}); });
// map.getView().fit([119.5091, 35.5671, 120.3285, 36.1455]);
// //
var layer = new ol.layer.Tile({ // var layer = new ol.layer.Tile({
source: new ol.source.TileSuperMapRest({ // source: new ol.source.TileSuperMapRest({
url: url, // url: url,
wrapX: true, // wrapX: true,
}), // }),
projection: 'EPSG:3857', // projection: 'EPSG:4326', //
}); // });
map.addLayer(layer); // map.addLayer(layer);
}; };
// //
@ -289,7 +308,7 @@ onMounted(() => {
getcornGetAllTownss(); // getcornGetAllTownss(); //
// //
// initMap(); // initMap();
add() add();
farmland(); farmland();
// ProgressBar(); // ProgressBar();
ASdivision(); ASdivision();