首页 / 浏览问题 / WebGIS / 问题详情
切换图层报错
22EXP 2023年06月06日
let map = this.map;

      this.removeUnderMapLayer(this.currentUnderMap);

      switch (obj.type) {

        case "tdt":

          map.addSource("tdtVec", {

            type: "raster",

            tiles: [

              //请求地址

              obj.url[0],

            ],

            //分辨率

            tileSize: 256,

          });

          map.addSource("tdtCva", {

            type: "raster",

            tiles: [

              //请求地址

              obj.url[1],

            ],

            //分辨率

            tileSize: 256,

          });

          map.addLayer(

            {

              id: "tdtVec",

              type: "raster",

              source: "tdtVec",

              minzoom: 0,

              maxzoom: 22,

            },

            "gl-draw-polygon-fill-inactive.cold"

          );

          map.addLayer(

            {

              id: "tdtCva",

              type: "raster",

              source: "tdtCva",

              minzoom: 0,

              maxzoom: 22,

            },

            "gl-draw-polygon-fill-inactive.cold"

          );

          var style1 = map.getStyle().layers;

          console.log(style1, "style3style4style");

          this.currentUnderMap = "tdt";

          break;

        case "arcgisMap":

          map.addSource("arcgisMap", {

            type: "raster",

            tiles: [

              //请求地址

              obj.url[0],

            ],

            //分辨率

            tileSize: 256,

          });

          map.addSource("tdtCva", {

            type: "raster",

            tiles: [

              //请求地址

              obj.url[1],

            ],

            //分辨率

            tileSize: 256,

          });

          map.addLayer(

            {

              id: "arcgisMap",

              type: "raster",

              source: "arcgisMap",

              minzoom: 0,

              maxzoom: 22,

            },

            "gl-draw-polygon-fill-inactive.cold"

          );

          map.addLayer(

            {

              id: "tdtCva",

              type: "raster",

              source: "tdtCva",

              minzoom: 0,

              maxzoom: 22,

            },

            "gl-draw-polygon-fill-inactive.cold"

          );

          var style = map.getStyle().layers;

          console.log(style, "style1style2style");

          // map.moveLayer("arcgisMap", 'RoadLine2_1@GZGQ_0(0_9)');

          // map.moveLayer("tdtCva", 'RoadLine2_1@GZGQ_0(0_9)');

          this.currentUnderMap = "arcgisMap";

          break;

        case "supermapMap":

          map.addSource("supermapMap", {

            type: "raster",

            tiles: [

              //请求地址

              obj.url[0],

            ],

            //分辨率

            tileSize: 256,

          });

          map.addLayer(

            {

              id: "supermapMap",

              type: "raster",

              source: "supermapMap",

              minzoom: 0,

              maxzoom: 22,

            },

            RemotesesingConfig.rasterFlagLayer

          );

          this.currentUnderMap = "supermapMap";

          break;

        default:

          break;

      }

切换图层报错

{
    "status": 429,
    "url": "http://t0.tianditu.gov.cn/vec_w/wmts?tk=c6593be49827aef69dbcdf610226abfa&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&TILEMATRIX=5&TILEROW=13&TILECOL=24&FORMAT=tiles",
    "name": "e",
    "message": "Too Many Requests"
}

2 个回答

429是请求太频繁了,key不是自己的吧,换个自己的试试
7EXP 2023年06月06日
换那个key啊

您好,根据请求状态提示是429,访问频繁。解决参考:https://blog.csdn.net/sinat_31213021/article/details/116739822

1,865EXP 2023年06月07日
怎么解决啊
...