月球大数据地理空间分析展示平台-【前端】-月球2期前端
surprise
2024-03-01 12075d0fa73d963ff5d6dbc4727fb95fb6084961
src/assets/js/Map/olMap.js
@@ -180,12 +180,11 @@
  addWmts(res) {
    this.initMap();
    console.log(res)
    console.log(res.category)
    if (res.category == 4) {//判断是否为Arcgis服务
      addArcGisWmst(res);
    } else {
      addGeoWmst(res);
      // addArcGisWmst(res)
    }
  },
};
@@ -271,21 +270,22 @@
  }, 500);
}
function addArcGisWmst(res) {
  console.log(res.url)
  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;
  }
  console.log(res.url)
  if(!olMapDate)return
  if(!olMapDate.extent)return;
  var extent = olMapDate.extent;
@@ -303,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({
@@ -325,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())
      }