Переглянути джерело

智能选址地图模块修改

liutao 3 місяців тому
батько
коміт
e14ad7381c

+ 1 - 0
web_ui/package.json

@@ -27,6 +27,7 @@
     "js-cookie": "^2.2.0",
     "jsts": "^2.8.1",
     "leaflet": "^1.9.4",
+    "proj4leaflet": "^1.0.2",
     "leaflet.markercluster": "^1.5.3",
     "leaflet.pm": "^2.2.0",
     "leaflet.tilelayer.gl": "^2.4.1",

+ 4 - 4
web_ui/src/util/leaflet.js

@@ -9,7 +9,7 @@ export function getWmtsLayer(layer) {
       version: "1.0.0",
       layer: "",
       style: "",
-      tilematrixset: "",
+      tilematrixset: "default028mm",
       format: "image/jpeg",
     },
 
@@ -68,7 +68,7 @@ export function getWmtsLayer(layer) {
         url +
         L.Util.getParamString(this.wmtsParams, url) +
         "&tilematrix=" +
-        tilematrix +
+        ident +
         "&tilerow=" +
         tilerow +
         "&tilecol=" +
@@ -93,7 +93,7 @@ export function getWmtsLayer(layer) {
       for (var i = 0; i < 22; i++) {
         matrixIds3857[i] = {
           identifier: "" + i,
-          topLeftCorner: new L.LatLng(20037508.3428, -20037508.3428),
+          topLeftCorner: new L.LatLng(90, -180),
         };
       }
       return matrixIds3857;
@@ -112,7 +112,7 @@ export function getWmtsLayer(layer) {
     layer.url,
     {
       layer: layer.layername,
-      tilematrixset: "EPSG:3857",
+      tilematrixset: "default028mm",
       Format: "image/png",
       TileMatrix: "EPSG:3857:15",
     }

+ 85 - 57
web_ui/src/views/industrial-land/AiIndustriaLandDetail.vue

@@ -319,6 +319,7 @@ import industrialTop from "@/components/IndustrialTop";
 import znxzDetail from "./ZnxzDetail.vue";
 import znxzCompare from "./ZnxzCompare.vue";
 import L from "leaflet";
+import Proj from "proj4leaflet"
 import ArrayQueue from "@/struct/ArrayQueue";
 import axios from "axios";
 import { arcgisToGeoJSON } from "@terraformer/arcgis";
@@ -861,6 +862,32 @@ export default {
       }
     },
     initMap() {
+        let CRS_4490 = new Proj.CRS("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs", {
+          resolutions: [
+              1.4062500262315807,
+              0.7031249999891485,
+              0.35156249999999994,
+              0.17578124999999997,
+              0.08789062500000012,
+              0.04394531250000006,
+              0.021972656250000007,
+              0.01098632812500002,
+              0.00549316406250001,
+              0.0027465820312500017,
+              0.0013732910156250009,
+              6.866455078124991E-4,
+              3.4332275390624957E-4,
+              1.7166137695312503E-4,
+              8.583068847656251E-5,
+              4.291534423828141E-5,
+              2.1457672119140645E-5,
+              1.0728836059570307E-5,
+              5.364418029785169E-6,
+              2.6822090642902305E-6,
+              1.3411045333348457E-6
+          ],
+          origin: [-400.0, 399.9999999999998]
+        });
       this.layers = window.ApplicationConfig.layerTreeConfig;
       this.layers.forEach((item, index) => {
         if (index == 0) {
@@ -874,71 +901,72 @@ export default {
         center: myCenter,
         zoom: this.zoomLevel,
         zoomControl: false,
+        crs: CRS_4490,
         attributionControl: false, //去掉右下角的logo
       });
       var tk = window.ApplicationConfig.tk;
       var tk = "6dfd31e3b55a8466f34997aee5551a9c";
       // 添加天地图底图
       //底图
-      const image = L.tileLayer(
-        "http://t{s}.tianditu.gov.cn/img_w/wmts?tk=" +
-          tk +
-          "&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}",
-        {
-          subdomains: [0, 1, 2, 3, 4, 5, 6, 7],
-          zIndex: 1,
-        }
-      );
-      this.map.addLayer(image);
-      const dx = L.tileLayer(
-        "https://t{s}.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=" +
-          tk,
-        {
-          subdomains: [0, 1, 2, 3, 4, 5, 6, 7],
-          transparent: true,
-          zIndex: 2,
-        }
-      );
-      this.map.addLayer(dx);
+      // const image = L.tileLayer(
+      //   "http://t{s}.tianditu.gov.cn/img_w/wmts?tk=" +
+      //     tk +
+      //     "&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}",
+      //   {
+      //     subdomains: [0, 1, 2, 3, 4, 5, 6, 7],
+      //     zIndex: 1,
+      //   }
+      // );
+      // this.map.addLayer(image);
+      // const dx = L.tileLayer(
+      //   "https://t{s}.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&tk=" +
+      //     tk,
+      //   {
+      //     subdomains: [0, 1, 2, 3, 4, 5, 6, 7],
+      //     transparent: true,
+      //     zIndex: 2,
+      //   }
+      // );
+      // this.map.addLayer(dx);
 
-      //注记
-      const cia = L.tileLayer(
-        "http://t{s}.tianditu.gov.cn/cia_w/wmts?tk=" +
-          tk +
-          "&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}",
-        {
-          subdomains: [0, 1, 2, 3, 4, 5, 6, 7],
-          transparent: true,
-          zIndex: 3,
-        }
-      );
-      this.map.addLayer(cia);
-      // let dtLayers = {
-      //   name: "底图",
-      //   layers: [
-      //     {
-      //       name: "浙江影像",
-      //       id: "zjyx",
-      //       checked: true,
-      //       type: "wmts",
-      //       url: "https://kjzl.zrzyt.zj.gov.cn/zdzy/gtkj/zjgt48/34048bffdd0d4d148ca4a40da7eade21/services/wmts/imgmap/default/oss",
-      //       layername: "imgmap",
-      //     },
-      //     {
-      //       name: "浙江注记",
-      //       id: "zjzj",
-      //       checked: true,
-      //       type: "wmts",
-      //       url: "https://kjzl.zrzyt.zj.gov.cn/zdzy/gtkj/zjgt48/34048bffdd0d4d148ca4a40da7eade21/services/wmts/imgmap_lab/default/oss",
-      //       layername: "imgmap_lab",
-      //     },
-      //   ],
-      // };
+      // //注记
+      // const cia = L.tileLayer(
+      //   "http://t{s}.tianditu.gov.cn/cia_w/wmts?tk=" +
+      //     tk +
+      //     "&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TileMatrix={z}&TileCol={x}&TileRow={y}",
+      //   {
+      //     subdomains: [0, 1, 2, 3, 4, 5, 6, 7],
+      //     transparent: true,
+      //     zIndex: 3,
+      //   }
+      // );
+      // this.map.addLayer(cia);
+      let dtLayers = {
+        name: "底图",
+        layers: [
+          {
+            name: "浙江影像",
+            id: "zjyx",
+            checked: true,
+            type: "wmts",
+            url: "https://kjzl.zrzyt.zj.gov.cn/zdzy/gtkj/zjgt48/34048bffdd0d4d148ca4a40da7eade21/services/wmts/imgmap/default/oss",
+            layername: "imgmap",
+          },
+          {
+            name: "浙江注记",
+            id: "zjzj",
+            checked: true,
+            type: "wmts",
+            url: "https://zdzy.zrzyt.zj.gov.cn/gtkj/zjgt49/2003392c13044d3ab3097b0a4328ecf2/services/wmts/imgmap_lab/default/oss",
+            layername: "imgmap_lab",
+          },
+        ],
+      };
 
-      // var zjyx = dtLayers.layers[0];
-      // this.switchMapLayer(zjyx);
-      // var zjzj = dtLayers.layers[1];
-      // this.switchMapLayer(zjzj);
+      var zjyx = dtLayers.layers[0];
+      this.switchMapLayer(zjyx);
+      var zjzj = dtLayers.layers[1];
+      this.switchMapLayer(zjzj);
 
       //定位浙江省
       this.location(polygons);

+ 3 - 25
web_ui/static/config.js

@@ -1,9 +1,9 @@
 (function (window) {
   window.ApplicationConfig = {
     serverURL: "/server",
-    // subscribeUrl: 'http://ai.zjugis.com:8511/subscribe/',
-    subscribeUrl: 'http://localhost:8511/subscribe/',
-    // subscribeUrl: '/agentai/subscribe/',
+    //subscribeUrl: 'http://ai.zjugis.com:8511/subscribe/',
+     //subscribeUrl: 'http://localhost:8511/subscribe/',
+     subscribeUrl: '/agentai/subscribe/',
     // subscribeUrl: 'http://192.168.0.145:8511/subscribe/',
     // zcbdUrl: 'http://ai.zjugis.com:8510/policy/#/home',
     // fgbdUrl: 'http://ai.zjugis.com:8510/policy/#/regulation',
@@ -57,34 +57,12 @@
     tk: 'f7c3163e305d6b2a4b6a14938b1932ae',
     routeUrl: 'http://api.tianditu.gov.cn/drive?postStr=',
     layerTreeConfig: [
-      // {
-      //   name: '底图', layers: [
-      //     {
-      //       name: "浙江影像",
-      //       id: "zjyx",
-      //       checked: true,
-      //       type: 'wmts',
-      //       url: 'https://zdzy.zrzyt.zj.gov.cn/gtkj/zjgt48/34048bffdd0d4d148ca4a40da7eade21/services/wmts/imgmap/default/oss',
-      //       layername: 'imgmap'
-      //     },
-      //     {
-      //       name: "浙江注记",
-      //       id: "zjzj",
-      //       checked: true,
-      //       type: 'wmts',
-      //       url: 'https://zdzy.zrzyt.zj.gov.cn/gtkj/zjgt49/2003392c13044d3ab3097b0a4328ecf2/services/wmts/imgmap_lab/default/oss',
-      //       layername: 'imgmap_lab'
-      //     }
-      //   ]
-      // }, 
       {
         name: '现状图层', layers: [
           {
             name: "可利用资源",
             id: "GD",
             checked: true,
-            // type: 'dynamic',
-            // url: '/arcserver-host/arcgis/rest/services/sde/ecgap_klyzy/MapServer'
             type: 'geoserver',
             url: 'https://zdzy.zrzyt.zj.gov.cn/geoserver/sde/wms',
             layername: 'sde:ecgap_klyzy'