Pārlūkot izejas kodu

天地图引入

Hwf 4 mēneši atpakaļ
vecāks
revīzija
7511eb52af
1 mainītis faili ar 17 papildinājumiem un 2 dzēšanām
  1. 17 2
      src/hooks/AMap/useAMap.ts

+ 17 - 2
src/hooks/AMap/useAMap.ts

@@ -64,8 +64,23 @@ export function useAMap(options) {
     if (type === 'vectorgraph') {
     if (type === 'vectorgraph') {
       map.removeLayer(nowLayer);
       map.removeLayer(nowLayer);
     } else if (type === 'satellite') {
     } else if (type === 'satellite') {
-      const satellite = new AMap.TileLayer.Satellite();
-      map.addLayer(satellite);
+      const satellite = new AMap.TileLayer.WMTS({
+        // url: 'http://t0.tianditu.gov.cn/img_c/wmts',
+        url: 'http://t4.tianditu.gov.cn/img_w/wmts',
+        blend: false,
+        tileSize: 256,
+        params: {
+          Layer: 'img',
+          Version: '1.0.0',
+          Format: 'tiles',
+          TileMatrixSet: 'w',
+          STYLE: 'default',
+          tk: 'a8df87f1695d224d2679aa805c1268d9' // 申请的天地图开发者key
+        }
+      });
+      satellite.setMap(map);
+      // const satellite = new AMap.TileLayer.Satellite();
+      // map.addLayer(satellite);
       nowLayer = satellite;
       nowLayer = satellite;
     }
     }
   };
   };