| | |
| | | |
| | | <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 ol.View({ |
| | | center: ol.proj.fromLonLat([4.606512, 2.621472]), |
| | | let view = new View({ |
| | | center: olProj.fromLonLat([4.606512, 2.621472]), |
| | | zoom: 13, |
| | | enableRotation: false, |
| | | }); |
| | |
| | | resolutions.push(topResolution / Math.pow(2, zoom)); |
| | | matrixIds[zoom] = zoom; |
| | | } |
| | | let LwSource = new ol.layer.Tile({ |
| | | source: new ol.source.WMTS({ |
| | | let LwSource = new Tile({ |
| | | source: new 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 ol.tilegrid.WMTS({ |
| | | tileGrid: new WMTSTileGrid({ |
| | | extent: [371987.18334, 252920.58593, 624459.12036, 423400.07714], |
| | | origin: [0, 688194], |
| | | resolutions: resolutions, |
| | |
| | | }, |
| | | mounted() { |
| | | this.mapList = mapType; |
| | | this.tileLayer1 = new ol.layer.Tile({ |
| | | this.tileLayer1 = new Tile({ |
| | | source: this.mapList.find((e) => e.id == this.locaMap1).value, |
| | | }); |
| | | // this.tileLayer2 = new Tile({ |
| | |
| | | }, |
| | | methods: { |
| | | initMap() { |
| | | new ol.Map({ |
| | | new Map({ |
| | | target: "mapContainer", |
| | | layers: [ |
| | | this.tileLayer1, |