温红权 3 years ago
parent
commit
1ac01fdf6d
1 changed files with 43 additions and 69 deletions
  1. 43 69
      ruoyi-ui/src/components/map/index.vue

+ 43 - 69
ruoyi-ui/src/components/map/index.vue

@@ -709,7 +709,7 @@ export default {
             map.getView().setZoom(13);
         },
         initprod: function() {
-            const proj3857 = getProjection("EPSG:4326");
+            // const proj3857 = getProjection("EPSG:4326");
              function getWMTSLayer(url, layer) {
                 let key = "98ec3e37b32974c2d58ea1a790640fe7"
                 let projection = getProjection("EPSG:3857");
@@ -741,81 +741,55 @@ export default {
                 })
 
             }
-            const tileGrid = new WMTSTileGrid({
-                tileSize: [256, 256],
-                origin: [-180.0, 90.0],
-                extent: [-180.0, -90.0, 180.0, 90.0],
-                resolutions: [
-                    0.703125,
-                    0.3515625,
-                    0.17578125,
-                    0.087890625,
-                    0.0439453125,
-                    0.02197265625,
-                    0.010986328125,
-                    0.0054931640625,
-                    0.00274658203125,
-                    0.001373291015625,
-                    6.866455078125e-4,
-                    3.4332275390625e-4,
-                    1.71661376953125e-4,
-                    8.58306884765625e-5,
-                    4.291534423828125e-5,
-                    2.1457672119140625e-5,
-                    1.0728836059570312e-5,
-                    5.364418029785156e-6,
-                    2.682209014892578e-6,
-                    1.341104507446289e-6,
-                    6.705522537231445e-7,
-                    3.3527612686157227e-7
-                ],
-                matrixIds: [
-                    "EPSG:4326:0",
-                    "EPSG:4326:1",
-                    "EPSG:4326:2",
-                    "EPSG:4326:3",
-                    "EPSG:4326:4",
-                    "EPSG:4326:5",
-                    "EPSG:4326:6",
-                    "EPSG:4326:7",
-                    "EPSG:4326:8",
-                    "EPSG:4326:9",
-                    "EPSG:4326:10",
-                    "EPSG:4326:11",
-                    "EPSG:4326:12",
-                    "EPSG:4326:13",
-                    "EPSG:4326:14",
-                    "EPSG:4326:15",
-                    "EPSG:4326:16",
-                    "EPSG:4326:17",
-                    "EPSG:4326:18",
-                    "EPSG:4326:19",
-                    "EPSG:4326:20",
-                    "EPSG:4326:21"
-                ]
+            var projection = getProjection("EPSG:3857");
+            var format = 'image/png';
+            var bounds = [13325725.763124488, 3757032.814272983,
+                13345293.642365493, 3776600.693513988
+            ];
+            var untiled = new ImageLayer({
+                source: new ImageWMS({
+                    ratio: 1,
+                    url: 'http://198.17.188.64/geoserver/gwc/service/wms',
+                    params: {
+                        'FORMAT': format,
+                        'VERSION': '1.1.1',
+                        "STYLES": '',
+                        "CJAUTH": 'CJUSER',
+                        "LAYERS": 'CJ:G_CJ',
+                        "TRANSPARENT": 'true',
+                        "exceptions": 'application/vnd.ogc.se_inimage',
+                    }
+                })
             });
 
-            const ign_source = new WMTS({
-                url: "http://198.17.1.146:9999/geoserver/gwc/service/wmts?CJAUTH=CJUSER",
-                layer: "CJ:G_CJ",
-                matrixSet: "EPSG:4326",
-                format: "image/png",
-                params:{
-                   "TRANSPARENT": 'true',
-                },
-                projection: proj3857,
-                tileGrid: tileGrid,
-                style: ""
-            });
 
-            const ign = new TileLayer({
-                source: ign_source,
+
+
+            var tiled = new TileLayer({
+                visible: false,
+                source: new TileWMS({
+                    url: 'http://198.17.188.64/geoserver/gwc/service/wms',
+                    params: {
+                        'FORMAT': format,
+                        'VERSION': '1.1.1',
+                        tiled: true,
+                        "STYLES": '',
+                        "CJAUTH": 'CJUSER',
+                        "LAYERS": 'CJ:G_CJ',
+                        "TRANSPARENT": 'true',
+                        "exceptions": 'application/vnd.ogc.se_inimage',
+                        tilesOrigin: 13325725.763124488 + "," + 3757032.814272983
+                    }
+                })
             });
+
             const map = new Map({
                 target: "map",
-                layers: [getWMTSLayer('http://198.17.188.64:9879/vec_w/wmts?tk=98ec3e37b32974c2d58ea1a790640fe7', 'vec'),getWMTSLayer('http://198.17.188.64:9879/cva_w/wmts?tk=98ec3e37b32974c2d58ea1a790640fe7', 'cva'),ign],
+                layers: [getWMTSLayer('http://198.17.188.64:9879/vec_w/wmts?tk=98ec3e37b32974c2d58ea1a790640fe7', 'vec'),getWMTSLayer('http://198.17.188.64:9879/cva_w/wmts?tk=98ec3e37b32974c2d58ea1a790640fe7', 'cva'),
+                    untiled,
+                    tiled],
                 view: new View({
-                    zoom: 2
+                   projection: projection
                 })
             });
             map.getView().fit([75.0, 20.0, 135.0, 50.0], map.getSize());