北京经济技术开发区经开区虚拟城市项目-【前端】-移动端Web
ZhAkps
2024-02-06 36d70ba5cf8508509ad8a57e4bf53bf955fddcbf
src/components/poplayer/history.vue
@@ -23,15 +23,15 @@
<script>
import mapType from "@/utils/maptype";
import { Map, View } from "ol";
import Tile from "ol/layer/Tile";
import WMTS from "ol/source/WMTS";
import WMTSTileGrid from "ol/tilegrid/WMTS";
import * as olProj from "ol/proj";
import XYZ from "ol/source/XYZ";
// import { Map, View } from "ol";
// import Tile from "ol/layer/Tile";
// import WMTS from "ol/source/WMTS";
// import WMTSTileGrid from "ol/tilegrid/WMTS";
// import * as olProj from "ol/proj";
// import XYZ from "ol/source/XYZ";
let view = new View({
  center: olProj.fromLonLat([4.606512, 2.621472]),
let view = new ol.View({
  center: ol.proj.fromLonLat([4.606512, 2.621472]),
  zoom: 13,
  enableRotation: false,
});
@@ -43,14 +43,14 @@
  resolutions.push(topResolution / Math.pow(2, zoom));
  matrixIds[zoom] = zoom;
}
let LwSource = new Tile({
  source: new WMTS({
let LwSource = new ol.layer.Tile({
  source: new ol.source.WMTS({
    url: "https://skyzt.bda.gov.cn/service/ImageEngine/picdis/abc?user=jjjskfq&password=Jjjskfq@2022",
    layer: "Shiliang_Lw_2019",
    style: "",
    format: "image/png",
    // 投影坐标系
    tileGrid: new WMTSTileGrid({
    tileGrid: new ol.tilegrid.WMTS({
      extent: [371987.18334, 252920.58593, 624459.12036, 423400.07714],
      origin: [0, 688194],
      resolutions: resolutions,
@@ -80,7 +80,7 @@
  },
  mounted() {
    this.mapList = mapType;
    this.tileLayer1 = new Tile({
    this.tileLayer1 = new ol.layer.Tile({
      source: this.mapList.find((e) => e.id == this.locaMap1).value,
    });
    // this.tileLayer2 = new Tile({
@@ -90,7 +90,7 @@
  },
  methods: {
    initMap() {
      new Map({
      new ol.Map({
        target: "mapContainer",
        layers: [
          this.tileLayer1,