From 12075d0fa73d963ff5d6dbc4727fb95fb6084961 Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期五, 01 三月 2024 09:32:40 +0800 Subject: [PATCH] 代码更新 --- src/assets/js/Map/olMap.js | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/assets/js/Map/olMap.js b/src/assets/js/Map/olMap.js index f6b9e0f..65f8492 100644 --- a/src/assets/js/Map/olMap.js +++ b/src/assets/js/Map/olMap.js @@ -180,11 +180,11 @@ addWmts(res) { this.initMap(); - if (res.category == 4) {//鍒ゆ柇鏄惁涓篈rcgis鏈嶅姟 addArcGisWmst(res); } else { addGeoWmst(res); + // addArcGisWmst(res) } }, }; @@ -270,19 +270,24 @@ }, 500); } function addArcGisWmst(res) { - olMap.initMap + + olMap.initMap(); var olMapDate = null; - if (res.url.indexOf('south') > -1) {//鍗楁瀬 + + if (res.cnName.indexOf('鍗楁瀬鎶曞奖') > -1) {//鍗楁瀬 olMapDate = proDate.south; - } else if (res.url.indexOf('north') > -1) {//鍖楁瀬 + } else if (res.cnName.indexOf('鍖楁瀬鎶曞奖') > -1) {//鍖楁瀬 olMapDate = proDate.north; - } else if (res.url.indexOf('near') > -1) {//鍖楁瀬 + } else if (res.cnName.indexOf('杩戝湴鎶曞奖') > -1) {//鍖楁瀬 olMapDate = proDate.near; - } else if (res.url.indexOf('far') > -1) {//鍖楁瀬 + } else if (res.cnName.indexOf('杩滃湴鎶曞奖') > -1) {//鍖楁瀬 olMapDate = proDate.far; - } else if (res.url.indexOf('equid') > -1) {//鍖楁瀬 + } else if (res.cnName.indexOf('绛夎窛绂�') > -1) {//鍖楁瀬 olMapDate = proDate.equid; } + + if(!olMapDate)return + if(!olMapDate.extent)return; var extent = olMapDate.extent; var mapCode = olMapDate.epsg; initPolarCoord() @@ -298,7 +303,8 @@ }; ol.proj.addProjection(proj); var ResolutionsAndMids = getResolutionsAndMids(12); - var arcUrl = res.url; + var arcUrl =olMap.getLayrUrl( res); + var arcgisLayer = new ol.layer.Tile({ source: new ol.source.XYZ({ @@ -320,16 +326,13 @@ let mousePositionControl = new ol.control.MousePosition({ coordinateFormat: (coordinate) => { var sourceProj = mapCode; - console.log("yuanshi",mapCode) + var destProj = "ESRI:104903"; // 鐩爣鍧愭爣绯讳负澧ㄥ崱鎵樻姇褰� var olLon = coordinate[0] var olLat = coordinate[1]; - console.log(olLon, olLat) var destCoord = ol.proj.transform([olLon, olLat], sourceProj, destProj); - store.state.olLon = destCoord[0].toFixed(6) store.state.olLat = destCoord[1].toFixed(6); - if (olMap.map) { store.state.olZoom = parseInt(olMap.map.getView().getZoom()) } -- Gitblit v1.9.3